I'm tring to apply a personal label on a file in clearcase vob.
I've used the command:
cleartool mklabel MY_LABEL TestFile.txt##\main\1
End the result is:
cleartool: Error: label type "MY_LABEL" not found in VOB "\TEST_vob"
and no global type defin cleartool: Error: Unable to create label
"MY_LABEL" on "TestFile.txt" version "\main\1".
I execute the command from command line in the same level of the file.
Am I using the command incorrectly, or is the command locked by a CC admin?
You should create the label type first using the cleartool mklbtype command
M:\myView\TEST_vob\aFolder> cleartool mklbtype -nc MY_LABEL
Created label type 'MY_LABEL'.
Then try your mklabel command again.
Related
I have an issue with ClearCase I was trying to check out a file from the dir by using ct co -nc file name, but I am getting the following error:
cleartool: Error: branch type "test1" not found in VOB "/dir/file" and no global type definition can be found.
cleartool: Error: Unable to create branch requested by -mkbranch option in config spec.
cleartool: Error: Unable to check out "file".
But when I was trying to check out another file from dir I am able to do them. I am only getting the problem to check out that file.
Can anyone help me how can I overcome this error?
This looks like a config spec using a branch named "test1" in a selection rule (element ... -mkbranch test1) which was not created first.
So first, check what the config spec looks like:
cleartool catcs
See also what the config spec are for the files in the parent folder of that file:
cd /path/to/§parent/folder
cleartool ls
See if using cleartool mkbrtype would help:
cleartool mkbrtype -c "test1 branch" test1#/vobs/avob
(I use the Unix syntax, judging from your previous config spec)
Looks like "test1" branch type does not exist in the vob.
Create a branch using ct mkbrtype. Run the following command form the folder where file is present
ct mkbrtype -nc test1
As the error is occurring only for one file, the config spec should have selection rule only for that file. Can check this using
ct catcs
Note:- When adding a branch rule in config spec, Always check the brtype exists with that name.
I want to check with a batch file if a certain element is already existent in Clearcase, or if I still have to add it.
How can I put this into a conditional statement?
Like:
if cleartool exists myFileName do myaction
else doOtherAction
You need to build a function which returns true or false depending on the element full name being part of the ClearCase view elements or not.
Then you can call that function from your if... else... statement.
Here are various commands that your function could use in order to determine if a file is a ClearCase element (meaning already added to source control) or not:
You can start by using the result of cleartool ls -l: if its output includes view-private object, it isn't added to source control yet.
cmd-context ls -long
version Makefile##\main\3 Rule: element * \main\LATEST
view private object bug.report
version cm_add.c##\main\0 Rule: element * \main\LATEST
derived object (unshared) hello##2007-03-24T11:32.418
version hello.h##\main\CHECKEDOUT from \main\2
Rule: element * CHECKEDOUT
Here 'bug.report' isn't added yet.
See more at "About view-private objects".
I already recommended that approach for a previous question using C#: "c# How to determine if a file is in ClearCase?".
Another approach is to use cleartool describe, which would trigger an error if the element described is a private one.
As mentioned in the technote "How to list view-private files in a view in Rational ClearCase", the command cleartool lsprivate works only in dynamic views, not in snapshot views.
For snapshot view, you can use: cleartool ls -r -view_only
Another approach is to use cleartool find, as in "Clearcase: How do I check if an element has a version on the trunk that was created after I branched off from the trunk?"
The following DOS batch file will add a file to ClearCase if it's not in there yet. Works in both dynamic and snapshot views.
#ECHO OFF
cleartool ls -l %1 | FIND "view private object"
IF %ERRORLEVEL% == 1 GOTO END
cleartool co -nc .
cleartool mkelem -nc -ci %1
cleartool ci -nc .
:END
You may want to add suitable comments instead of using the -nc switch.
I wish to merge an activity with my activity, the former activity has new directories and new elements.
I am getting the following error on issuing a merge with the following command
ct findmerge activityname#/vob/** -fcsets -nc -merge
The errors are as follows in 2 cases
Case1: No new elements created directly the merge command
Errors
/vob/**/Build.mk [checkedout but removed]
/vob/**/file1 [checkedout but removed]
/vob/**/file2 [checkedout but removed]
/vob/**/file3 [checkedout but but removed]
cleartool: Error: Checked out version, but could not copy data to "/vob/siren/oam/sdh/pkg/Build.mk" in view: Permission denied.
Correct the condition, then uncheckout and re-checkout the element.
Case2: I created the elements and the directory structure still the same error
Note: There are no errors for the elements which already exist in the vob
Try again your findmerge activity (as described here), but this time, without using cleartool setview (meaning without using a path starting with /vob, the mounting point for the dynamic view set by cleartool setview).
Always use the full path of the destination dynamic view (the one where the merge occur): as I told you in your previous question, cleartool setview is nothing but trouble.
Use:
cd /view/yourDestinationView/vobs/siren
ct findmerge activityname#/vob/** -fcsets -nc -merge
I am trying to label all the elements within a branch of a view, but some of the elements do not get labeled and instead give me a "No such file or Directory" error. I can see the files that generated the error in my command window, but they are highlighted in red. It seems like these files are not there and are thus generating the error. How can I remove these "files" from the view so that the labeling can continue and not generate errors?
Say that bolded words represent red highlighting. This is what I see:
file1 file2 directory1 directory2
Here is how my code is structured in my shell script:
cleartool mkview -tag $VIEWNAME ... (etc.)
cleartool setcs -tag $VIEWNAME configSpec.txt
cd /projectDirectory
labelname=`date "+%b-%d-%y"`
cleartool mklbtype -nc $labelname
cleartool mklabel -recurse $labelname /projectDirectory
The script starts recursing through the file tree from the projectDirectory. When it encounters file1 or directory1, I get the "No such file or directory" error. Otherwise, for file2 and directory2, the labeling occurs properly.
So, my question is this: How can I use the mklabel command or some other method to label all the files that are not highlighted in red?
You must first know the exact status of the "files in red"
For that, go in a shell to their parent folder, and type:
cleartool ls
That will give you their status (eclipsed?, private? other?), which will explain why the label cannot proceed.
Possible causes:
the files are symlinks
the files have spaces in their names (that shouldn't be the case here: cleartool mklabel should support that case)
the files are in the lost+found folder (solution: exclude that folder from your view with a -none selection rule)
Note: if an element isn't selected (no version selected and Rule: -none), then a recurse mklabel is supposed to generate that error message, but that won't prevent the label to be set on the other elements version.
So that error message should be safely ignored.
I could not find the proper command to apply a label to files which are in my current view. I have tried the following command:
cleartool mklabel -r TEST_LABEL /vob/test/a
However, the problem is that this command will apply the "Test_Label" label to every files in the "vob/test/a" directories regardless of whether the files are in my current view.
Is there any command to apply label only to the files listed in my current view?
cleartool mklabel -r(ecurse) LABEL_NAME <directory name>
This command will apply LABEL_NAME to all files in folder and below of your view, you can just go to that directory,then type following command to create and apply label
> cd /vob/test/a
> cleartool mklbtype –nc TEST_LABEL
> cleartool mklabel -r TEST_LABEL .
The mklabel documentation state states, as to what version is labeled:
Processes the entire subtree of each pname that is a directory element (including pname itself). VOB symbolic links are not traversed during the recursive descent into the subtree.
One example mentions:
Attach that label to the version of the current directory selected by your view, and to the currently selected version of each element in and below the current directory.
Now, if you want to be really sure of the versions actually labelled, one solution is to use a find command, combined with your mklabel:
cleartool find . -cview -exec "cleartool mklabel TEST_LABEL \"%CLEARCASE_XPN%\""
If you had already that label applied to incorrect version and want to move it:
cleartool find . -cview -exec "cleartool mklabel -replace TEST_LABEL \"%CLEARCASE_XPN%\""
That way, you can first list the versions involved:
cleartool find . -cview -print
And then, if you agree with the output, apply the mklabel through the -exec directive.
The OP user1096966 reports making it work with a cleartool ls, to be sure to select only element visible in the current view:
cleartool ls -r -vis
The is no '-exec' directive, so a pipe might be involved, as in (not tested, but you get the idea):
cleartool ls -r -vis -s -nxn | xargs cleartool mklabel -replace TEST_LABEL
The doco is really clear about what is being labelled, in fact the first example shown in doco states that exactly...current view objects are labelled by default & currently selected versions (i.e. if in your view then label it, else not.)
....extract below from doco below (note: context and command and that label-type-selector pname is the last parameter...left blank below because resident in working dir)...
Example:
•Create a label type named REL6. Attach that label to the version of the current directory selected by your view, and to the currently selected version of each element in and below the current directory.
cmd-context> mklbtype –nc REL6
Regards
Jim2