Ryan Latham
Ryan Latham

Reputation: 59

How do I label new files on a branch using cleartool?

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?

Upvotes: 1

Views: 1306

Answers (1)

VonC
VonC

Reputation: 1324497

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.

Upvotes: 2

Related Questions