问题
From a snapshot view using base ClearCase, I want to checkout the latest version of a file from a branch that is NOT selected in my snapshot view. I would expect this to be possible, because you can do it from the version tree browser tool.
However, the documentation for the checkout command claims that you can't do this in a snapshot (emphasis mine): [edit: Yes you can! See below.]
Nonstandard checkouts
By default, the checkout command checks out these versions:
- The most recent version on a branch, if you are using a dynamic view
- The version currently loaded in the view, if you are using a snapshot view
To modify a different version, you can either use the –version option or create a subbranch at that version. (See the mkbranch reference page). Furthermore, from a single view, you can have only one checkout per element at a time.
Note: When you work in a snapshot view, the only version of a directory element that can be checked out is the version currently loaded in the view. Therefore, the –version and –branch options do not work.
How can I check out an unselected version from the command line?
[edit: Here I misread the "Note:" section. What the help means is that directories can't be checked out using the -version
or -branch
args, but normal files can be.]
回答1:
The actual solution selected by the OP dss539 is to use cleartool checkout
directly (see cleartool checkout man page)
cleartool checkout -bra/nch branch-pname | -ver/sion
It would work for files (not directories) in dynamic or snapshot view.
If you don't want to modify the config spec of your current snapshot file, then you can:
either use a separate view (a dynamic one in order to have the right version immediately selected), and modify at will the config spec of that other (dynamic view),
And copy the version back to your snapshot view.
See also "How would you select versions from a specific branch in ClearCase?" for config spec example.
...
Actually, you don't even need to modify the config spec of that dynamic view:
You can use the extended pathname of the version you want to directly access and copy the right version.or use the cleartool get command (which is what "Send To" is doing on the version Tree).
See "clearcase command to backup predecessor version of a file?"
(You don't need a separate view here)
来源:https://stackoverflow.com/questions/16218464/clearcase-checkout-version-not-selected-by-config-spec