2

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?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Nait
  • 1,055
  • 1
  • 14
  • 19

1 Answers1

2

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • See http://stackoverflow.com/questions/2923328/what-are-the-differences-between-a-snapshot-view-and-a-dynamic-view/2925378#2925378 on dynamic views. – VonC Aug 26 '11 at 13:29
  • I'm merely a summer worker here and unfortunately don't have a say in whether dynamic or static views should be used. Is there no way to accomplish this with a static view? – Nait Aug 26 '11 at 13:34
  • @Nait: Yes, through ct diff, as my last link illustrates (http://stackoverflow.com/questions/176858/in-clearcase-how-can-i-view-old-version-of-a-file-in-a-static-view-from-the-com/177350#177350). But dynamic views are made precisely to get access to and explorer *all* version (and you perfectly can a snapshot and a dynamic view with the same configuration). – VonC Aug 26 '11 at 14:05