如何访问当前的 Subversion 内部版本号? [英] How to access the current Subversion build number?

查看:48
本文介绍了如何访问当前的 Subversion 内部版本号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 subversion 中自动导入最新的构建/修订号?

How can you automatically import the latest build/revision number in subversion?

目标是像 SO 一样在您的网页页脚上显示该数字.

The goal would be to have that number visible on your webpage footer like SO does.

推荐答案

svn info <Repository-URL>

svn info --xml <Repository-URL>

然后看结果.对于 xml,解析/info/entry/@revision 以获取存储库的修订(在此示例中为 151)或/info/entry/commit/@revision 以获取针对此路径的最后一次提交的修订(133,在使用标签):

Then look at the result. For xml, parse /info/entry/@revision for the revision of the repository (151 in this example) or /info/entry/commit/@revision for the revision of the last commit against this path (133, useful when working with tags):

<?xml version="1.0"?>
<info>
<entry
   kind="dir"
   path="cmdtools"
   revision="151">
<url>http://myserver/svn/stumde/cmdtools</url>
<repository>
<root>http://myserver/svn/stumde</root>
<uuid>a148ce7d-da11-c240-b47f-6810ff02934c</uuid>
</repository>
<commit
   revision="133">
<author>mstum</author>
<date>2008-07-12T17:09:08.315246Z</date>
</commit>
</entry>
</info>

我为自己编写了一个工具(cmdnetsvnrev,包括源代码),用于替换我的 AssemblyInfo.cs 文件中的修订版.虽然仅限于此目的,但通常 svn info 然后处理是要走的路.

I wrote a tool (cmdnetsvnrev, source code included) for myself which replaces the Revision in my AssemblyInfo.cs files. It's limited to that purpose though, but generally svn info and then processing is the way to go.

这篇关于如何访问当前的 Subversion 内部版本号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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