tags:

views:

1226

answers:

1

How Can I load of older version of a directory in a UCM snapshot view? In our project one developer checked-in not complated and non compilable code to ClearCase. Other developer updated her view then he was not compiling project because of previous developers's not complated code. So developer only wants to get previous version of directory.How Can I do this in snahpshot view and only for a specific directory?

A: 

A first possibility would be to try and select the correct version of the sub-directory to revert, like:

element /path/to/directory /main/[branch]/[version]

But that would be plain wrong, because:

  • extended path names is not supported in snapshot view, as explained in this SO question.

  • to select the directory alone is not enough (the files would still be selected as the LATEST versions available on the stream!)

And anyway, that would need to be added carefully in the config spec because:

  • you cannot add a selection rule (element ...) anywhere in the config spec:
    • if you put that rule at the end, it will be ignored (because of previous selection rules which are picked first)
    • if you put it at the beginning, it will work until the next "setcs -stream" occurrence (or the next time you push "Synchronize with stream"). At that time, the config spec of an UCM view (snapshot or dynamic) is regenerated (according to the configuration of the stream) and overrides your custom rule.


A possible solution would be to modify your config spec of your snapshot view with a time-based rule
(It modifies the meaning of the special version label LATEST; the rule selects from a branch the last version that was created before a particular time;
see 'cleartool man config_spec'):

# Add the following temporary rule only for your sub-directory and below
# (hence the '...')
element /aVob/myComponent/mySubDirectory/... .../STREAM_NAME/LATEST -time dd-Month-yyyy

element "[02945650fb1411d68504000180bdc4b6=\aVob]/myComponent/..." .../STREAM_NAME/LATEST
element "[02945650fb1411d68504000180bdc4b6=\aVob]/myComponent/..." FOUNDATION_BASELINE -mkbranch STREAM_NAME
element "[02945650fb1411d68504000180bdc4b6=\aVob]/myComponent/..." /main/0 -mkbranch STREAM_NAME

Just tested in a snapshot UCM view: it works.
Adapt the date format to the date and time you need to revert that sub-directory to the proper state.

VonC
I've deleted my answer due to it being wrong and incomplete. I've now learned a little bit about UCM views - never used those before. Thanks.
Kristo
@Kristo: no problem, your initial suggestion was interesting, but not adapted to the one presented in the question. I have re-phrased my answer to *not* mention your initial answer ;)
VonC
@VonC You are my ClearCase hero :)Thanks both of you.
mcaaltuntas
@mcaaltunas: I am glad that solution worked for you.
VonC