1

To provide some context, I am trying to write a script which will take a text file with clearcase elements in it, and label all of those elements.

To generate the text file, I am basically using the following command:

cleartool find -a -nxn -ele "brtype(branchName)" -print > "textfile.txt"

Then I go through the text file and remove the elements I don't want to label. The last step would be to feed the text file into a script which would repeatedly call a cleartool command on each line of the file.

For all existing files/folders, I can run this command:

cleartool mklabel -rep "label_name" (element_path)

Where I run into trouble is with files that have been added to the branch. They print out to the text file in a format that isn't recognized by the "mklabel" command and I can't find a good way to parse them.

The format of the files is similar to the following:

\original_folder_path@@\branch_name\version_number\new_sub_folder_path\branch_name\version_number\file_name.java

In the past I have used this generic command we use at my company to blindly label all files in a branch:

cleartool find -all -branch "brtype(<branch>)" -version "version(.../<branch>/LATEST) && !version(.../<branch>/0)" -visible -exec "cleartool mklabel -rep <label_name> %CLEARCASE_XPN%"

But I only want to label about half the files on the branch I am using, and there are too many to label them individually. I am sure I am missing something obvious here. Does anyone know how I should change my find or mklabel command to accommodate the new files and folders?

Ryan Latham
  • 59
  • 1
  • 8

1 Answers1

2

That format "\original_folder_path@@\branch_name\version_number" is an extended pathname, and isn't reserved for "added file".

It is current rather for files listed by a cleartool find, but not visible (directly accessible) in the view used by the cleartool find.

You need to make sure to use a view which is set to select the LATEST from brname.

If you see extended pathnames in your cleartool find, you can ignore them: they are not accessible by said view.

Or you could use a cleartool find -cview, in order to limit the results to what you view is able to select and see.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I tried the find command in my main snapshot view, and like you said, the extended pathname files appeared in the normal format. The funny thing is I was using a view with the same config spec when I was seeing the extended pathnames. The only difference was the original view was a dynamic view. Guess that makes a difference. Thanks for the help. I would upvote but don't have enough rep. – Ryan Latham Mar 05 '14 at 16:03
  • @RyanA.Latham the two views should yield the same "find" result, if their config spec (in term of selection rules, the "`element * xxx` rules) are identical. – VonC Mar 05 '14 at 16:37