如何建立分支 [英] How to create a branch

查看:74
本文介绍了如何建立分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建分支?

有人可以向我解释这些语法吗?

How to create a branch?
Could anyone explain these syntax to me?

element  * /main/LATEST -mkbranch karthik_4 

并假设,如果我的最新版本是 6 ,但我想在 4 如何完成?

And suppose, if my latest version is 6 but i want to create a branch at 4 how it is done?

推荐答案

创建分支不能在一个选择规则中完成。

配置规范的思想是,ClearCase会尝试按顺序应用每个规则,直到适合为止(然后针对该元素,文件或目录停止,然后再次尝试相同的一组规则以用于下一个元素-文件或目录)。

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:


  • 在新分支的最新 c版本中显示所有元素

  • 还没有新的分支,将显示 main LATEST 版本,如果发生结帐,则准备创建新分支,

  • ,或者,如果这是一个全新的元素(添加到源e control),将创建版本 / main / 0 ,然后立即分支以在新分支中创建版本1:

  • 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:

(同样,按顺序应用了这3条规则,在第一个合适的位置停了下来,这就是为什么这样排序的原因)

(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

注意:... / karthik_4 / LATEST语法是为了不将 karthik_4 分支绑定到main:即使 karthik_4 的任何其他分支的顶部(这就是 ... / ),它仍然会选择该新分支的最新版本(如果存在,如果不存在,则ClearCase尝试下一条规则)。

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)

创建分支始终涉及3条规则,

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

现在,作为您之前看到的,这不会从特定版本(如 4)创建分支。 br>
它将仅在主分支上以其最新版本的文件版本创建分支:LATEST被称为移位标签:在每个新版本上它都会自动移位。

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

但这很难扩展,因为旁边的文件myFile 可能有不同的历史记录,其版本4可能早于 myFile @@ / main / 4 或之前创建的(或其他文件可能还不存在版本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!).

这篇关于如何建立分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆