如何确定根目录中的最新SVN版本号? [英] How do you determine the latest SVN revision number rooted in a directory?

查看:205
本文介绍了如何确定根目录中的最新SVN版本号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开始用最新的SVN版本号标记已部署的二进制文件。

I would like to start tagging my deployed binaries with the latest SVN revision number.

但是,由于SVN是基于文件的,而不是基于目录/项目的,我需要浏览所有目录和子目录的文件以确定最高修订版本。

However, because SVN is file-based and not directory/project-based, I need to scan through all the directory's and subdirectory's files in order to determine the highest revision number.

使用 svn信息在根目录上不起作用(它仅报告该目录的版本,而不报告子目录中的文件):

Using svn info on the root doesn't work (it just reports the version of that directory, not files in subdirectories):

我想知道是否使用 svn 命令执行此操作。否则,谁能建议一个简单的脚本来提高网络效率(我更希望它根本不影响远程服务器)?

I was wondering if there is a shortcut using the svn command to do this. Otherwise, can anyone suggest a simple script that is network-efficient (I would prefer if it didn't hit the remote server at all)?

我也理解一个另一种方法是使用 svn:keywords 保留版本文件。可行(我已经在其他项目上使用过它),但是我厌倦了确保文件不脏以及不可避免的合并冲突。

I also understand that one alternative approach is to keep a version file with the svn:keywords. This works (I've used it on other projects), but I get tired of dealing with making sure the file is dirty and dealing with the inevitable merge conflicts.

答案,我看到我的问题在于在调用 svn信息之前没有进行适当的 svn上载根目录:

Answer I see my problem lied with not doing a proper svn up before calling svn info in the root directory:

$ svn info
Path: .
...
Last Changed Author: fak
Last Changed Rev: 713
Last Changed Date: 2008-08-29 00:40:53 +0300 (Fri, 29 Aug 2008)

$ svn up
At revision 721.

$ svn info
Path: .
...
Revision: 721
Last Changed Author: reuben
Last Changed Rev: 721
Last Changed Date: 2008-08-31 22:55:22 +0300 (Sun, 31 Aug 2008)


推荐答案

一种方法。当您签出代码时,请看svn输出的最后一行:

One way. When you check out the code, look at the last line of svn output:

$ svn up
...stuff...
Updated to revision 66593.

更直接的方法:

$ svn info
Path: .
URL: https://svn.example.com/svn/myproject/trunk
Repository Root: https://svn.example.com/svn/
Repository UUID: d2a7a951-c712-0410-832a-9abccabd3052
Revision: 66593
Node Kind: directory
Schedule: normal
Last Changed Author: bnguyen
Last Changed Rev: 66591
Last Changed Date: 2008-09-11 18:25:27 +1000 (Thu, 11 Sep 2008)

这篇关于如何确定根目录中的最新SVN版本号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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