是否可以在 ClearCase 配置规范中使用变量?

发布于 2024-07-16 07:50:47 字数 316 浏览 4 评论 0 原文

例如,我不想写以下内容:

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%

这可能吗? 正确的语法是什么?

For example, instead of writing the following:

element * .../my_branch_01/LATEST
element * .../base_branch/LATEST -mkbranch my_branch_01

I would want to write something like this:

MY_BRANCH=my_branch_01
element * .../%MY_BRANCH%/LATEST
element * .../base_branch/LATEST -mkbranch %MY_BRANCH%

Is this even possible? What is the correct syntax?

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

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

发布评论

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

评论(2

想你只要分分秒秒 2024-07-23 07:50:47

在 ClearCase 中执行此操作的唯一本机方法是在 配置规范

根据 版本选择器 规则,您可以基于属性创建“按查询选择”规则:

element * ...{MY_ATTRIBUTE_NAME=="aValue"}

将在任何分支上选择 LATEST 版本其中包含“aValue”的属性“MY_ATTRIBUTE_NAME”。

这意味着您需要更改旧分支上的属性值,将其放在新分支上,再次“cleartool setcs”您的视图,并且您应该拥有基于新版本选择的新内容。

不是很直接,但它可以工作,除了 mkbranch 部分(需要固定名称)。


关于GeekCyclist的回答,有一些评论:

包含通用配置规范的解决方案适用于 Base ClearCase 解决方案,但是:

  • 需要位于所有相关开发人员可用的共享中
  • setcs 确实有必要Ccuss view_server 刷新其缓存并重新评估当前配置规范,该配置规范存储在视图存储目录中的文件 config_spec 中。 这包括:
    • 评估具有非绝对规范的时间规则(例如,现在、星期二)
    • 重新评估 –config 规则,可能选择与以前不同的派生对象
    • 重新读取包含规则中指定的文件
  • 所有其他开发人员都需要当公共包含的配置规范文件更改时收到通知(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:

element * ...{MY_ATTRIBUTE_NAME=="aValue"}

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:

  • need to be in a share available by all concerned developer
  • the setcs is indeed necessary to Ccuses the view_server to flush its caches and reevaluate the current config spec, which is stored in file config_spec in the view storage directory. This includes:
    • Evaluating time rules with nonabsolute specifications (for example, now, Tuesday)
    • Reevaluating –config rules, possibly selecting different derived objects than previously
    • Re-reading files named in include rules
  • all the other developers need to be notified when the common included config spec file changes (there is no native notification included in ClearCase)

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.

草莓味的萝莉 2024-07-23 07:50:47

自从我在 ClearCase 工作以来已经有一段时间了(我们切换到 Subversion),但如果我没记错的话,没有办法在 ClearCase 中本地完成此操作。

您可以使用或编写一个脚本生成器来创建您的规范文件,然后将其包含在实际规范中:

element * CHECKEDOUT
include scripted_file_output

然后运行

cleartool setcs -current

​​这种方法的问题是,我相信包含规范需要重新生成,并且每当您更改时,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:

element * CHECKEDOUT
include scripted_file_output

Then run

cleartool setcs -current

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.

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