tags:

views:

64

answers:

1

Given a file system path such as "D:\pkirkham_view\VOB\Folder" or "U:\VOB\Folder\", is there a mechanism to get the path which would work in the config-spec to to load that folder "/VOB/Folder/" ?
Either CAL or cleartool commands would be fine. This is to run on client machines with ClearCase LT installed.

(I haven't found anything usable in CCElement.get_PathInView() or the various cleartool ls commands I've tried)

+1  A: 

There is no native command, but the only load rule you need is based on a vob name.

So you need a script able to:

1/ remove everything including the name of the view (which you can obtain with a '<aPathTo>\VOB\Folder\;cleartool cleartool lsview -s -cview)

D:\pkirkham_view\VOB\Folder => \VOB\Folder
U:\VOB\Folder\              => \VOB\Folder

2/ Build your load rule accordingly:

load \VOB\Folder

3/ Append that load rule to your config spec (if you are already within the view):

cleartool catcs > aConfisgpec.txt
echo "load \VOB\Folder" >> aConfisgpec.txt
cleartool setcs aConfisgpec.txt

The OP comments:

So, if I create a snapshot view whose tag name is 'pkirkham_testing_view' on path 'D:\thursday', how is that a substring extract?

That is a good point, since one can name the root directory with any name.
I would recommend naming that directory with the tag of the view.

But that is not the case, you need to determine the root directory of a snapshot view:

  1. start in 'D:\whatever\path\VOB\Folder',
  2. try a cleartool lsview -cview:
  3. if it respond correctly, cd .., and repeat 2.
  4. When it exit with an error, remove the substring of that directory from the initial path. What remains will be your load rule.
VonC
The bit I'm missing is whatever is generating the mapping `D:\pkirkham_view\VOB\Folder => \VOB\Folder` you have above.
Pete Kirkham
@Pieter: it is a simple substring extract: 1/ get the view name, 2/ remove everything including the view name, hence the `D:\pkirkham_view\VOB\Folder => \VOB\Folder`. You need to remove `D:\pkirkham_view` from the current view path in order to get a path you can use in a load rule.
VonC
So, if I create a snapshot view whose tag name is 'pkirkham_testing_view' on path 'D:\thursday', how is that a substring extract?
Pete Kirkham
@Pete: it won't, since you can name the root directory with whatever name you want. I would recommend naming that directory with the tag of the view. if not, you need to determine the root directory of a snapshot view: start in '`D:\whatever\path\VOB\Folder`', try a `cleartool lsview -cview`: if it respond correctly, `cd ..`, and repeat. When it exit with an error, remove the substring of that directory from the initial path. What remains will be your load rule.
VonC
@Pete: I just edited my answer to include the "snapshot root directory finder" algorithm.
VonC