获取远程存储库的修订号

发布于 2024-07-15 03:26:10 字数 417 浏览 5 评论 0原文

在本地计算机上,使用 svnversion 获取 subversion 存储库的修订号是没有问题的。 现在我想从我的在线存储库(带有 Apache2 的 WebDAV)获取修订号。

我尝试了这个:

svnversion http://nick:[email protected]/svn/test`

在浏览器中它像往常一样工作(只是为了确保没有拼写错误等),但是 svnversion 说找不到该目录。 所以我想我走错了路。

我如何获得修订号?

On the local machine it is no problem to get the revision number of a subversion repository with svnversion. Now I want to get the revision number from my online repository (WebDAV with Apache2).

I tried this:

svnversion http://nick:[email protected]/svn/test`

In a browser it worked as usual (just to ensure there weren't typos or so), but svnversion said that the directory cannot be found. So I presume I was on the wrong track.

How can I get the revision number?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

心房的律动 2024-07-22 03:26:11

在新版本的 svn (1.9) 上,您可以执行以下操作:

svn info --show-item revision svn://...
18436 

这应该仅返回修订号。

如果您的语言环境不是英语,所有 grep 版本都会中断。

对于以前的版本,您可以尝试

svn info --xml | grep '<entry' -3 | awk -F '=' '/revision="/ { print $2 }' | grep -o '[0-9]\+'

如果您可以拥有 xml2 包,更好的方法是:

svn info --xml | xml2 | grep /info/entry/@revision | grep -o '[0-9]\+' 

On new version of svn (1.9) you can do:

svn info --show-item revision svn://...
18436 

This should return only the revision number.

All the grep version will break if your locale is not english.

For previous version, you can try

svn info --xml | grep '<entry' -3 | awk -F '=' '/revision="/ { print $2 }' | grep -o '[0-9]\+'

If you can have the xml2 package a better way is to do:

svn info --xml | xml2 | grep /info/entry/@revision | grep -o '[0-9]\+' 
凉世弥音 2024-07-22 03:26:10

svnversion 仅适用于工作副本,但查询存储库的一种方法是使用 svn info 如下:

svn info http://nick:[email protected]/svn | grep Revision

svnversion is just for working copies, but one way to query your repository would be to use svn info as follows:

svn info http://nick:[email protected]/svn | grep Revision
╰沐子 2024-07-22 03:26:10

在 Linux 上,如果您只需要修订号:

svn info http://nick:[电子邮件受保护]/svn/test | grep '^修订版:' | awk '{打印$2}'

On Linux, if you want just the revision number:

svn info http://nick:[email protected]/svn/test | grep '^Revision:' | awk '{print $2}'

红墙和绿瓦 2024-07-22 03:26:10

一个方便的 AWK 单行代码,仅获取数字部分:

svn info http://nick:[email protected]/svn | awk '/Revision:/ { print $2 }'

A handy AWK one-liner to get only the number portion:

svn info http://nick:[email protected]/svn | awk '/Revision:/ { print $2 }'
幻梦 2024-07-22 03:26:10
svn info http://nick:[email protected]/svn/test

应该返回有关远程存储库的信息,包括修订版本

svn info http://nick:[email protected]/svn/test

should return information about the remote repository, including Revision

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文