如何创建分支

发布于 2024-11-18 15:17:04 字数 173 浏览 1 评论 0原文

如何创建分支?
谁能给我解释一下这些语法吗?

element  * /main/LATEST -mkbranch karthik_4 

假设,如果我的最新版本是 6 但我想在 4 创建一个分支,该怎么做?

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 want to create a branch at 4 how it is done?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风尘浪孓 2024-11-25 15:17:04

创建分支不能在一个选择规则中完成。
配置规范背后的想法是,ClearCase 将尝试按顺序应用每个规则,直到一个适合(然后停止该元素、文件或目录,并再次按顺序尝试相同的一组规则,以用于下一个元素 - 文件或目录)。

因此,选择规则的以下有序组合将:

  • 显示新分支的LATEST版本中的所有元素
  • ,或者,如果还没有新分支,将显示main 的 >LATEST 版本,准备在检出时创建一个新分支,
  • 或者,如果这是一个全新的元素(“添加到源代码控制”),将创建一个版本 /main/0,然后立即分支以便在新分支中创建版本 1:(

同样,这 3 个规则按顺序应用,在第一个适合的规则处停止,这就是它们以这种方式排序的原因)

将翻译为以下配置规范:

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

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

创建分支总是涉及 3 条规则,而不仅仅是一条。

现在,正如您之前看到的,这不会从特定版本创建分支(如“4”)。
它只会在主分支上的最新版本的文件中创建一个分支:最新版本称为移动标签:它会在每个新版本中自动移动。

您可以为一个文件指定要从中创建分支的确切版本:

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 可能尚不存在!)。

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!).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文