如何在UCM ClearCase中从命令行或脚本设置视图元素基线?

时间:2016-06-01 12:17:58

标签: clearcase clearcase-ucm cleartool

如何在脚本的UCM ClearCase快照视图配置规范中选择具有特定基线的元素?

我正在编写一个脚本,该脚本将创建给定流的快照视图,并应选择流内容的特定基线版本。我更喜欢以与设置加载规则相同的方式设置元素基线,但无法找到方法。

这是我到目前为止所做的事情:

...
cleartool mkview -snapshot -tag ${cc_view} -ptime -stream ${cc_stream}@\\myVob -vws ${cc_dir}/${cc_view}.vws ${cc_dir}/${cc_view} || die "Failed to create view. Exiting."
cd ${cc_dir}/${cc_view}
# Set the element baselines
cleartool edcs -overwrite
cleartool update -overwrite -add_loadrules ${components} || die "Failed to update view. Exiting."
...

另一个问题可能是我无法在自定义块的配置规范中设置元素版本 - 我必须在组件选择规则中执行此操作!覆盖UCM的“组件选择规则”部分感觉有点危险。我在edcs阶段执行此操作:

ucm
identity UCM.Stream <...id...>
# ONLY EDIT THIS CONFIG SPEC IN THE INDICATED "CUSTOM" AREAS
# This config spec was automatically generated by the UCM stream
# "myStream" at 2017-06-01T07:43:33+02:00.
# Select checked out versions
element * CHECKEDOUT
# Component selection rules...
element "[ee5a<...id...>=\MYCOMPONENT]/..." my-component-1.0 -nocheckout
end ucm
#UCMCustomElemBegin - DO NOT REMOVE - ADD CUSTOM ELEMENT RULES AFTER THIS LINE
#UCMCustomElemEnd - DO NOT REMOVE - END CUSTOM ELEMENT RULES
# Non-included component backstop rule: no checkouts
element * /main/0 -ucm -nocheckout
#UCMCustomLoadBegin - DO NOT REMOVE - ADD CUSTOM LOAD RULES AFTER THIS LINE
load \MYCOMPONENT

<小时/> 相关问题:

<小时/> 正如VonC建议我转移到基础CC:

...
cleartool mkview -snapshot -tag ${cc_view} -ptime -vws ${cc_dir}/${cc_view}.vws ${cc_dir}/${cc_view} || die "Failed to create view. Exiting."
cd ${cc_dir}/${cc_view}
cat << EOF > config_spec
element * CHECKEDOUT
element * ${baseline} -nocheckout
element * /main/LATEST
EOF
cleartool setcs -force -overwrite config_spec || die "Failed to set config spec. Exiting."
cleartool update -overwrite -add_loadrules ${components} || die "Failed to update view. Exiting."
...

1 个答案:

答案 0 :(得分:1)

首先,只有baseline is full才会有效 如果是增量的,您可能会选择带有标签(与基线相关联)的元素,该元素未在父文件夹中设置,从而使该元素无法访问。

其次,这种自定义选择最好使用您拥有的非UCM基础ClearCase快照视图:

  • 与您的UCM快照视图相同的加载规则
  • 但是一组更简单的选择规则:

    element * yourBaselineId
    element * /main/LATEST