如何创建分支
如何创建分支?
谁能给我解释一下这些语法吗?
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建分支不能在一个选择规则中完成。
配置规范背后的想法是,ClearCase 将尝试按顺序应用每个规则,直到一个适合(然后停止该元素、文件或目录,并再次按顺序尝试相同的一组规则,以用于下一个元素 - 文件或目录)。
因此,选择规则的以下有序组合将:
LATEST
版本中的所有元素
版本,准备在检出时创建一个新分支,main
的 >LATEST/main/0
,然后立即分支以便在新分支中创建版本 1:(同样,这 3 个规则按顺序应用,在第一个适合的规则处停止,这就是它们以这种方式排序的原因)
将翻译为以下配置规范:
这 : .../karthik_4/LATEST 语法的存在是为了不将
karthik_4
分支绑定到主分支:即使karthik_4
是在任何其他分支之上创建的main
(这就是.../
的意思),它仍然会选择该新分支的最新版本(如果存在,如果不存在,ClearCase 会尝试下一个规则)创建分支总是涉及 3 条规则,而不仅仅是一条。
现在,正如您之前看到的,这不会从特定版本创建分支(如“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:
LATEST
version of the new branchLATEST
version ofmain
, ready to create a new branch if a checkout occurs,/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:
Note: the .../karthik_4/LATEST syntax is there in order to not tie
karthik_4
branch to main: even ifkarthik_4
was created on top on any other branch thatmain
(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:
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 aftermyFile@@/main/4
(or version 4 might not exist yet for the other files!).