belwood
belwood

Reputation: 3779

How can a ClearCase directory version be determined for a given file version?

Because ClearCase updates directory version numbers when files inside are created, our config-spec generating script is failing (details omitted).

So, as an example, given a file such as "/proj/src/scripts/build.sh@@/main/branch42/3", how can we determine the latest version of the scripts directory that contains that version of the build.sh file.

Note: we're looking for a unix command-line solution that can be scripted.

Upvotes: 1

Views: 793

Answers (2)

VonC
VonC

Reputation: 1323553

Another approach is to:

  • set a label on the right version of the build.sh script and its directory (you can move that label when needed)
  • have a second dynamic view always configured to select that label
    element * SCRIPT_LABEL
    element /proj/... .../branch42/LATEST

That way, you simply read the information you need from that second dynamic view.

Upvotes: 1

hlovdal
hlovdal

Reputation: 28180

If you do a ls /proj/src/scripts@@/main/branch42/*/build.sh/main/branch42/3 you should get a list of all versions of the scripts directory that contain version .../3 of build.sh. Then you should be able to pick out the latest of those.

The above is probably not a fool proof approach, so you might try something more like

cleartool find /proj/src/scripts --allversions --nonvisible -name build.sh -version 'brtype(branch42) && version(3)' -print

(I no longer have a clearcase environment to test in, so the above is from memory and is not an accurate command)

Upvotes: 1

Related Questions