本文介绍了用大写字母获取文件版本的脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过脚本获得文件的大写版本。

I would like to get a file's clearcase version by means of a script. Is that possible?

谢谢。

推荐答案

最可靠的方法要获取文件的版本,请执行以下操作:

The surest way to get the version of a file is to:


  • 使用CLI命令

  • 使用 选项可用于 命令。

  • use the CLI command 'cleartool'
  • combine it with the fmt_ccase options available for a cleartool describe command.

cleartool descr -fmt "%Vn" myFile

,无需解析任何内容:如果是版本文件,结果将不会为空。

That way, no need to parse anyhting: if this is a versioned file, the result won't be an empty one.

cleartool descr -fmt "\tElement: %-13.13En Version: %Vn\n" util.c
Element: util.c Version: /main/rel2_bugfix/1

注意:如果文件为CHECKEDOUT,则可能要在 -pred (前身) > descr 命令:

Note: if the file is CHECKEDOUT, you might want to add the option -pred (predecessor) to the descr command:

ct descr -fmt "%Vn" .project
\main\MyProject_Int\MyProject_Dev\CHECKEDOUT
ct descr -pred -fmt "%Vn" .project
\main\MyProject_Int\MyProject_Dev\CHECKEDOUT  predecessor version: \main\MyProject_Int\MyProject_Dev\4

或仅使用%PVn (结果相同,但不涉及解析)

or just use %PVn (same result, but no parsing involved)

ct descr -fmt "%PVn" .project
\main\MyProject_Int\MyProject_Dev\4

这篇关于用大写字母获取文件版本的脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 17:12