Question

So I'm writing a script at work where I have to go through all the projects in a ClearCase vob, look for a file and parse some info from said file.
Naturally, I wouldn't want to load every single project so I'm using cleartool to retrieve the unloaded files.
First, I'm using the find command to locate the files. This was my first attempt:

root>cleartool find C:/viewpath -name file.txt -version "lbtype(Version-label)" -print -nr

Viewpath is the path to the project where I'm currently looking for the file. The file I'm looking for is file.txt on the version specified by Version-label.
This gave me no result whatsoever, even though I knew file.txt existed on that version.
I figured out it was looking through an old version of the directory, the latest on the main-branch, which was before file.txt was added to the directory. I tried this instead:

root>cleartool find C:/viewpath@@/Version-label -name file.txt -version "lbtype(Version-label)" -print -nr

And got this result, which was what I was looking for

C:/viewpath\file.txt@@\main\branch\41

So now that I knew where I could find the file I tried to get it.

root>cleartool get -to savepath C:/viewpath\file.txt@@\main\branch\41

Which gave me this result

cleartool: Error: "C:/viewpath\file.txt@@\main\branch\41" does not exist, or is not a ClearCase version, or is a checked out version which was removed.

Also tried

root>cleartool get -to savepath C:/viewpath\file.txt@@/Version-label

With the same result

I can get files added to the directory when it was still on the main-branch, so it is still searching through the directory on the main-branch, where file.txt is nowhere to be found.
How do I tell it to look through a version of the directory from after it was branched from main?

Was it helpful?

Solution

I would really recommend for you to try those same commands in a dynamic view.
As illustrated here, a dynamic view gives you access to extended path (the file@@/branch/version syntax), which means command like get will work.
You have in this question an example of search (cleartool find) using extended paths.

As explained in "In ClearCase, how can I view old version of a file in a static view, from the command line?", you can browse (as in 'change directory to') the various extended paths of a file in a dynamic view.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top