Sub-branching in ClearCase?

2019-06-27 20:15发布

问题:

When I want to use a branch in CC, I usually put something like this in the config spec:

element * .../first_branch/LATEST
element * .../Main/LATEST -mkbranch first_branch
element * ../Main/LATEST

Now, I want to create a branch that is a sub-branch of the first one. Let's say it's called second_branch (I'm creative today). How would that config spec look like?

回答1:

Like this:

element * .../second_branch/LATEST
element * .../first_branch/LATEST -mkbranch second_branch
element * .../Main/LATEST -mkbranch first_branch
element * ../Main/LATEST

Your view will now look at the latest version on second_branch, or, if it doesn't exist, the latest version on first_branch, or, if it doesn't exist there, the latest version on the main branch. Upon checking out a file, a new version element will be created on respectively second_branch and first_branch as necessarily.

I don't have access to a ClearCase instance right now, so I can't double check your last two lines, but I think that perhaps you meant this instead?

element * .../second_branch/LATEST
element * .../first_branch/LATEST -mkbranch second_branch
element * /Main/LATEST -mkbranch first_branch


回答2:

To add to Kim's answer, I much prefer starting a branch from a label than the LATEST versions selected by a branch.
That way, I know what 'second_branch' stands from and where it comes from.
(coming from the LATEST of another branch means it comes from a moving point which represents something different as time goes by)

element * .../second_branch/LATEST
element * A_LABEL -mkbranch second_branch
element * .../first_branch/LATEST
element * .../Main/LATEST -mkbranch first_branch
element * ../Main/LATEST

If you set A_LABEL on a view configured to be:

  • at the LATEST of 'first_branch'
  • at a 'stable' state

,then you can branch from a known point.