clearfsimport does not remove files at the component root dir - clearcase

I am using this command line to import files into a VOB:
clearfsimport -recurse -rmname -nsetevent -filter <sourceDir>/* <vobComponentRootDir>
Content of sourceDir:
fileA
fileB
Content of vobComponentRootDir before import:
fileC
Content of vobComponentRootDir after import:
fileA
fileB
fileC
fileC is not removed, despite I used '-rmname' option.
I suspect it is because it is at the root of the component
I want to automate this import and have the same content in sourceDir and vobComponentRootDir.
How can I complete this ?

The -rmname option that I mentioned in "How to delete file elements by file extension in ClearCase?" for clearfsimport might now always work:
"clearfsimport -rmname may not detect removed directories if wildcards are used to specify source directories"
"clearfsimport -rmname does not work for files at the root directory"
The second link is relevant here and would explain why fileC remains.
This is working as designed.
The -rmname option only applies to directories and you must be in a vob directory when you run the command.
It is best to not use a full vob as a component, but to use a multi-component vob.
If not possible, then you can try and move the content of vobComponentRootDir in a subfolder (just for the clearfsimport to work): vobComponentRootDir\subfolder.
And move that same content back in vobComponentRootDir once the cleafsimport is completed.

Related

How to specify -log parameter in cleartool update command

I am trying to automate updating my clearcase view and build the code in a bat file. I want to run the update command and then check the log to verify its success. For this I want to save the update log in a specified location rather than its default location
Now, cleartool allows you to specify your own log file within the cleartool console
cleartool>update -log pname
but when i use the same as a single command, it doesnt work
D:> cleartool -log pname --------- THIS DOESNT WORK
any ideas?
Thanks
RB
you need to do (from cleartool update man page):
cleartool update -log pname /path/to/root/view/directory
A cleartool update outside a view won't work.
A cleartool update with the path of a root view directory will work.
If you specify that root directory, then you can execute the cleartool update command from any path, including D:\.
pname ...
If you do not specify –add_loadrules, this argument specifies the files and directories to update.
All specified directories, including the root directory of the snapshot view, are updated recursively.

Cleartool removing a checkedout file from a folder with rmname

How can I use cleartool rmname to remove a file, that is checkedout by some one else, from a folder? Is this possible?
The command-line cleartool rname -force is only necessary when the file is checked out in another branch.
That allows to bypass the error message: 'file' has checkouts
In that case, you need to check out the parent directory first, rmname, and then don't forget to check in the parent directory, or your file will still be visible by others.
See more at the technote "About cleartool rmname and checkouts"
There is a -force option available for cleartool rmname from command line that will allow the command execution to work even while there are checkouts.
This option forces the removal of the name from the directory when there is at least one checkout of the element, but it does not actually cancel any checkouts of the element.

Delete file from ClearCase checked out on another branch

I am trying to delete a file in ClearCase. When I attempt to delete it I get a message that the element has checkouts. When I do a version tree on the file I see that the file is checked out by another user, in another view, on a different branch.
How do I delete this file? In addition why doesn't ClearCase let me delete this file?
You can delete it through the command line and cleartool, by forcing its delete (option which isn't available with the GUI)
cleartool rmname -force theFile
Don't forget to checkout the parent directory first, then to checkin that same parent directory, in order for everyone to see that you have dereferenced that file within said directory.
See cleartool rmname:
–f/orce:
Forces the removal of the name when there is at least one checkout of the element.
When used with –nco, suppresses the prompt for confirmation.
That will work even when you had this before:
, as explained in the technote "About cleartool rmname and checkouts".

rename element in clearcase with ## in filename

For some reason some users produced some files that end in "##" (...) (I think because they have in the CCRC the gui option to show the version extended pathname and i think that has somewhere a little bug).
Now... they are unable to remove or rename these files (it returns "not a object in the vob")
how can they rename or remove these files?
update
Resolved I forgot to use the complete rmname "a.doc####\bla\1", after the full path i could delete them.
The simplest solution would be to try to list and remove those objects from a base ClearCase view directly on the CCRC server (or any base ClearCase client).
From this kind of ClearCase installation (CCRC server or full ClearCase client), you do have access to cleartool (the ClearCase CLI -- Command Line Interface --), and you can:
cleartool ls: list the files in the view, to check those files with ## are indeed there
cleartool rmane -force to remove them
The OP used
cleartool rmname "a.doc####\bla\1"
, meaning he had to use the extended path (file name + ## + version path) of the file ended with ##, hence the four #: file####version.

ClearCase - file system path to element path

Given a file system path such as "D:\pkirkham_view\VOB\Folder" or "U:\VOB\Folder\", is there a mechanism to get the path which would work in the config-spec to to load that folder "/VOB/Folder/" ?
Either CAL or cleartool commands would be fine. This is to run on client machines with ClearCase LT installed.
(I haven't found anything usable in CCElement.get_PathInView() or the various cleartool ls commands I've tried)
There is no native command, but the only load rule you need is based on a vob name.
So you need a script able to:
1/ remove everything including the name of the view
(which you can obtain with a '<aPathTo>\VOB\Folder\;cleartool cleartool lsview -s -cview)
D:\pkirkham_view\VOB\Folder => \VOB\Folder
U:\VOB\Folder\ => \VOB\Folder
2/ Build your load rule accordingly:
load \VOB\Folder
3/ Append that load rule to your config spec (if you are already within the view):
cleartool catcs > aConfisgpec.txt
echo "load \VOB\Folder" >> aConfisgpec.txt
cleartool setcs aConfisgpec.txt
The OP comments:
So, if I create a snapshot view whose tag name is 'pkirkham_testing_view' on path 'D:\thursday', how is that a substring extract?
That is a good point, since one can name the root directory with any name.
I would recommend naming that directory with the tag of the view.
But that is not the case, you need to determine the root directory of a snapshot view:
start in 'D:\whatever\path\VOB\Folder',
try a cleartool lsview -cview:
if it respond correctly, cd .., and repeat 2.
When it exit with an error, remove the substring of that directory from the initial path. What remains will be your load rule.

Resources