livefree75
livefree75

Reputation: 763

Finding a element version in ClearCase that exists in only certain versions of its parent directory

Here is the situation.

Let's say I have a file, "foo.cpp". Its parent directory is /path/to/foo/ .

So, foo.cpp exists only in:

/vobs/myvob/path/to/foo@@/main/release/2/foo.cpp@@/main/release/some-branch/{versions}

where {versions} are several versions of foo.cpp e.g. 1, 2, 3, LATEST.

My config spec is very generic, as my script needs to parse over hundreds of different branches in order to find certain versions of the files:

element * CHECKEDOUT
element * /main/release/LATEST
element * /main/LATEST

So clearly,

ct find . -name 'foo.cpp' -print 

will not find foo.cpp on branch "some-branch".

I tried:

ct find . -a -nvi -name 'foo.cpp' -branch 'brtype(some-branch)' -print
ct find . -a -nvi -name 'foo.cpp' -print | grep some-branch
ct find . -a -nvi -name '*' | grep foo.cpp

None of these found foo.cpp.

Any ideas? Could my config spec be modified in any way to make this easier?

Upvotes: 1

Views: 640

Answers (2)

iclman
iclman

Reputation: 1436

If you are 100% sure that the file is in /vobs/myvob/path/to/foo@@/main/release/2, you could modify your config spec to have

element * CHECKEDOUT
element /vobs/myvob/path/to/foo /main/release/2
element * /main/release/LATEST
element * /main/LATEST

Then, perform your search as described above. You will then not need -nvi option as you will be in a view that can see the object.

Taking into account you want a generic answer, I would then suggest the usage of the following command

 cleartool find -all -name "foo.cpp" -version 'brtype(some-branch)' -print

Don't use -nvi option unless you want to list only the versions that are not visible in your view.

Upvotes: 0

VonC
VonC

Reputation: 1324337

From "Additional examples of the cleartool find command":

The cleartool find command is used to locate ClearCase objects within a VOB, and is not restricted by the view's configuration specification (config spec).

Make sure to use a dynamic view.

ct find . -a -nvis -name 'foo.cpp' -ver 'brtype(some-branch)' -print
# or:
ct find . -nvis -name 'foo.cpp' -ver 'brtype(some-branch)' -print

The option -ver is mandatory in order to find and list versions.

Upvotes: 1

Related Questions