是否可以在 ClearCase 配置规范中使用变量?
例如,我不想写以下内容:
element * .../my_branch_01/LATEST
element * .../base_branch/LATEST -mkbranch my_branch_01
我想写这样的内容:
MY_BRANCH=my_branch_01
element * .../%MY_BRANCH%/LATEST
element * .../base_branch/LATEST -mkbranch %MY_BRANCH%
这可能吗? 正确的语法是什么?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 ClearCase 中执行此操作的唯一本机方法是在 配置规范。
根据 版本选择器 规则,您可以基于属性创建“按查询选择”规则:
将在任何分支上选择
LATEST
版本其中包含“aValue
”的属性“MY_ATTRIBUTE_NAME
”。这意味着您需要更改旧分支上的属性值,将其放在新分支上,再次“
cleartool setcs
”您的视图,并且您应该拥有基于新版本选择的新内容。不是很直接,但它可以工作,除了 mkbranch 部分(需要固定名称)。
关于GeekCyclist的回答,有一些评论:
包含通用配置规范的解决方案适用于 Base ClearCase 解决方案,但是:
如果您需要一个具有可变内容(取决于不同分支)的“环境”(即一个“视图”或工作区) ,您需要定义一个指向不同视图(每个视图都有自己的配置规范)的符号链接(或Windows subst),
这样,您只需更改链接(或替换的路径)即可更改配置与给定固定路径关联的规范。
The only native way to do this in ClearCase is to use attribute within a config-spec.
According to the version selector rules, you can make a "selection by query" rule, based for instance on an attribute:
would select the
LATEST
version on any branch with an attribute 'MY_ATTRIBUTE_NAME
' with 'aValue
' in it.That mean you need to change the attribute value on the old branch, put it on the new branch, '
cleartool setcs
' your view again, and you should have a new content based on a new version selection.Not very straight forward, but it could work, except for the mkbranch part (which needs a fixed name).
Regarding GeekCyclist's answer, a few comments:
The solution to include a common config spec can work for Base ClearCase solution, but:
If you need to have one "environment" (i.e. one "view" or workspace) with a variable content (depending on a different branch), you need to define a symbolic link (or a windows subst) pointing to different views (each with their own config spec)
That way, you only have to change the link (or the path subst'ed) in order to change the config spec associated with a given fixed path.
自从我在 ClearCase 工作以来已经有一段时间了(我们切换到 Subversion),但如果我没记错的话,没有办法在 ClearCase 中本地完成此操作。
您可以使用或编写一个脚本生成器来创建您的规范文件,然后将其包含在实际规范中:
然后运行
这种方法的问题是,我相信包含规范需要重新生成,并且每当您更改时,cleartool setcs 都会运行MY_BRANCH 的值。
It's been a while since I worked in ClearCase (we switched to Subversion), but if I recall correctly there is no way to do this native to ClearCase.
You could use or write a script generator that would create your spec file and then include that in the actual spec:
Then run
The problem with this approach is that I believe the include spec would need to be regenerated and the cleartool setcs run whenever you change the value of MY_BRANCH.