ClearCase : Loading Older Version of a specific Directory?

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.

Leave a Comment

tech