获取WinCvs中标记文件的修订号 [英] Get revision number of a tagged file in WinCvs

查看:58
本文介绍了获取WinCvs中标记文件的修订号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎应该很简单,但是我找不到任何可行的解决方案...

This seems like it should be so simple, but I can't find any solution that appears to work...

我需要一个CVS命令,

I need a CVS command that given the name of a tag that you have applied to a file, it will give you the revision number.

CVS树结构:

(filename)
    |
    +--> 1.1-----(branch)
          |         |
          |      1.1.1.1---(tag1)
          |         |
          |      1.1.1.2---(tag2)
          |         |
          |      1.1.1.3---(tag3)
          |         |
          |         :
         1.2
          |
          |
          :



例如:使用CVS命令,给定标签名称 tag2,我怎样才能得到CVS给我修订号 1.1.1.2?






我能找到的最接近的东西是使用带有 -Q 标志的 log 命令,但这仍然为我提供了比我所需更多的信息。

For example: Using a CVS command, given the tag name "tag2", how can I get CVS to give me the revision number "1.1.1.2"?


The closest thing I can find is using the log command with the -Q flag, but that still gives me much more information than I need.

例如: cvs -Q log -h文件名

将标记名传递给 log 命令似乎无效。

Passing the tagname to the log command seems to have no effect.

CVS版本信息:

我当前的解决方案是使用perl脚本来解析 log 命令,但必须有一种更简单的方法...

My current solution is to use a perl script to parse the output from the log command but there has to be a simpler way...

推荐答案

传递标记名(带有-r选项)到log命令确实有效果,只是不是特别有用

Passing a tag name (with a -r option) to the log command does have an effect, just not a particularly useful one and it's effect is hidden by "-h".

通常是获得 VERSION 文件(通常的用例)是在其中包含关键字;即:

Usually the easiest way to get a revision number for your VERSION file (the normal use-case for this) is to include a keyword in it; ie:

# Thu 21 May 08:40:59 BST 2015
THISREV="$Revision$"

注意:要获取版本号 VERSION 的存储库版本号必须在每次每次提交存储库时提交文件。

Note: to get a repository version number this VERSION file must be committed every time you make a commit to the repo.

如果您需要对特定文件进行修订,则基本上从日志的符号名称部分退回脚本。因此,对于 r-1-0-0 ,您可以执行以下操作:

If you need a revision for a specific file then you're basically falling back on scripting from the "symbolic names" part of the log. So for r-1-0-0 you do this:

cvs -Q log -h VERSION | awk '/^\tr-1-0-0:/ {print $NF;}'

没有与 git describe 命令直接等效的东西。

There's no direct equivalent of the git describe command.

这篇关于获取WinCvs中标记文件的修订号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆