开发者

How to create a branch

How to create a branch?

Could anyone explain these syntax to me?

element  * /main/LATEST -mkbranch karthik_4 

And suppose, if my latest version is 6 but i 开发者_如何学Gowant to create a branch at 4 how it is done?


Creating a branch cannot be done in one selection rule.
The idea behind a config spec is that ClearCase will try applying each rule in order until one fits (then it stops for that element, file or directory, and try the same set of rules, again in order, for the next element - file or directory).

So the following ordered combination of selection rule will:

  • display all elements in their LATEST version of the new branch
  • or, if there is no new branch yet, will display the LATEST version of main, ready to create a new branch if a checkout occurs,
  • or, if this is a brand new element (an "add to source control"), will create a version /main/0, and then immediately branch in order to create version 1 in the new branch:

(again, those 3 rules are applied in order, stopping at the first one that fits, which is why they are ordered that way)

That would translate in the following config spec:

element * .../karthik_4/LATEST
element * /main/LATEST -mkbranch karthik_4 
element /main/0 -mkbranch karthik_4

Note: the .../karthik_4/LATEST syntax is there in order to not tie karthik_4 branch to main: even if karthik_4 was created on top on any other branch that main (which is what .../ means), it would still select the LATEST version of that new branch (if it exists, if not ClearCase tries the next rule)

Creating a branch always involve 3 rules, not just one.

Now, as you saw earlier, this won't create a branch from a specific version (like '4').
It will only create a branch at whatever version a file is in its LATEST version on the main branch: LATEST is called a shifting label: it shifts automatically at each new version.

You could specify, for one file, the exact version you want to create a branch from:

element * .../karthik_4/LATEST
element /path/to/myFile /main/4 -mkbranch karthik_4 
element * /main/LATEST -mkbranch karthik_4 
element /main/0 -mkbranch karthik_4

But that won't scale easily, since the file next to myFile is likely to have a different history, and its version 4 might have been created long before or after myFile@@/main/4 (or version 4 might not exist yet for the other files!).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜