Get specific version of unloaded file with cleartool
Asked Answered
R

1

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?

Rochdale answered 26/8, 2011 at 12:56 Comment(0)
F
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.

Fissirostral answered 26/8, 2011 at 13:23 Comment(3)
See #2923828 on dynamic views.Fissirostral
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?Rochdale
@Nait: Yes, through ct diff, as my last link illustrates (#177358). 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).Fissirostral

© 2022 - 2024 — McMap. All rights reserved.