当前 Subversion 修订命令 [英] Current Subversion revision command

查看:28
本文介绍了当前 Subversion 修订命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有显示当前版本号的 Subversion 命令?

Is there a Subversion command to show the current revision number?

svn checkout 之后,我想启动一个脚本并需要变量中的修订号.如果有像 svn info get_revision_number 这样的命令就好了.

After svn checkout I want to start a script and need the revision number in a variable. It would be great if there is a command like svn info get_revision_number.

推荐答案

较新版本的 svn 支持 --show-item 参数:

Newer versions of svn support the --show-item argument:

svn info --show-item revision

对于本地工作副本的修订号,请使用:

For the revision number of your local working copy, use:

svn info --show-item last-changed-revision

您可以使用 os.system() 来执行这样的命令行:

You can use os.system() to execute a command line like this:

svn info | grep "Revision" | awk '{print $2}'

我在每晚构建脚本中这样做.

I do that in my nightly build scripts.

在某些平台上还有一个 svnversion 命令,但我想我有理由不使用它.啊,对.您无法使用 svnversion 从远程存储库获取修订号以将其与本地存储库进行比较.

Also on some platforms there is a svnversion command, but I think I had a reason not to use it. Ahh, right. You can't get the revision number from a remote repository to compare it to the local one using svnversion.

这篇关于当前 Subversion 修订命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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