4

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.]

dss539
  • 6,804
  • 2
  • 34
  • 64
  • You can always set your config spec to that branch –  Apr 25 '13 at 15:14
  • Yeah I could. I want to create a script that checks out several files from another branch, makes some automated modifications to those files, and then checks them in on a different branch. If this has to be done by updating my config spec, that would be pretty annoying. But it may be the only way :( – dss539 Apr 25 '13 at 15:18
  • I really don't think you can check out from a branch that's not in your view.. maybe there is a way but I have never seen that in my normal workflow. –  Apr 25 '13 at 15:28
  • @0A0D - If you're using windows, open the version tree browser for a file. Right click some node that is not selected by your current spec. There, I see an option "Check out..." as the first item in the menu. – dss539 Apr 25 '13 at 18:38
  • Interesting, never had to try that. –  Apr 25 '13 at 19:14

1 Answers1

2

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:

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks, I'll try this and accept if it works for me. You mention the "Send To" in the version tree, but what about the "Check out..."? Does it also use a `cleartool get`? – dss539 Apr 25 '13 at 18:38
  • btw - thanks for your many other ClearCase posts on SO. They're all very helpful! – dss539 Apr 25 '13 at 18:38
  • If it uses `cleartool checkout`, how does it get the version that is not currently selected by the view? – dss539 Apr 25 '13 at 21:26
  • @dss539 because it checks out the same **extended pathname** I mention in my answer. Look at your config spec (`cleartool catcs`): the *first* rule is: `element * CHECKEDOUT`. So once any version is checked out, it is selected by that first rule. On checking, there will be a merge with the LATEST version in order to create a new LATEST version. – VonC Apr 26 '13 at 05:11
  • Hmm. Ok so **extended pathname** does, in fact, work in snapshot views. I thought that it did not, due to my misreading of the CC help. So that means I can checkout files on any branch without having a separate view of config spec. I'll edit my question to highlight the part I misread. – dss539 Apr 26 '13 at 14:31
  • @dss539 yes, if you want to *copy* an extended pathname, you need a dynamic view, but if you want to checkout, you can do so from *any* view. – VonC Apr 26 '13 at 14:33