将当前 svn 版本写入文本文件 [英] Write current svn version into text file

查看:31
本文介绍了将当前 svn 版本写入文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 rails 站点.我想在 mongrel 重新启动时将当前的 svn 版本写入 public/version.txt,以便我可以将其放入页眉的注释中.

问题是获取当前本地版本的 svn - 我有点困惑.

例如,如果我对一个有一段时间没有更新的文件执行 svn update,我会得到在修订版 4571.".但是,如果我做 svn 信息,我会得到

路径:.
网址:http://my.url/trunk
存储库根:http://my.url/lesson_planner
存储库 UUID:#########
修订:4570
节点种类:目录
时间表:正常
最后更改的作者:max
最后更改版本:4570
最后更改日期:2009-11-30 17:14:52 +0000(2009 年 11 月 30 日星期一)

注意这里说的是修订版 4570,比上一个命令低 1.

谁能告诉我如何简单地获取当前版本号?

谢谢,最大

解决方案

Subversion 附带了一个执行此操作的命令:SVVERSION.EXE.

用法:svnversion [OPTIONS] [WC_PATH [TRAIL_URL]]

为工作副本路径生成一个紧凑的版本号"WC_PATH.TRAIL_URL 是 URL 的结尾部分,用于确定 WC_PATH 本身是否已切换(检测开关WC_PATH 内不依赖于 TRAIL_URL).版本号写入标准输出.例如:

$ svnversion ./回购/SVN/树干4168

如果工作正常,版本号将是一个单一的数字副本是单一修订版,未修改,未切换且带有与 TRAIL_URL 参数匹配的 URL.如果工作副本不常见,版本号会更复杂:

4123:4168 混合修订工作副本
4168M 修改后的工作副本
4123S 切换工作副本
4123:4168MS 混合修订、修改、切换工作副本

如果在非工作副本的目录上调用,导出目录说,程序会输出'exported'.

如果不带参数调用 WC_PATH 将是当前目录.

有效选项:-n [--no-newline] : 不输出尾随换行符-c [--committed] : 最后更改而不是当前修订-h [--help] : 显示此帮助--version : 显示版本信息

I have a rails site. I'd like, on mongrel restart, to write the current svn version into public/version.txt, so that i can then put this into a comment in the page header.

The problem is getting the current local version of svn - i'm a little confused.

If, for example, i do svn update on a file which hasn't been updated in a while i get "At revision 4571.". However, if i do svn info, i get

Path: .
URL: http://my.url/trunk
Repository Root: http://my.url/lesson_planner
Repository UUID: #########
Revision: 4570
Node Kind: directory
Schedule: normal
Last Changed Author: max
Last Changed Rev: 4570
Last Changed Date: 2009-11-30 17:14:52 +0000 (Mon, 30 Nov 2009)

Note this says revision 4570, 1 lower than the previous command.

Can anyone set me straight and show me how to simply get the current version number?

thanks, max

解决方案

Subversion comes with a command for doing exactly this: SVNVERSION.EXE.

usage: svnversion [OPTIONS] [WC_PATH [TRAIL_URL]]

Produce a compact 'version number' for the working copy path WC_PATH. TRAIL_URL is the trailing portion of the URL used to determine if WC_PATH itself is switched (detection of switches within WC_PATH does not rely on TRAIL_URL). The version number is written to standard output. For example:

$ svnversion . /repos/svn/trunk 
4168

The version number will be a single number if the working copy is single revision, unmodified, not switched and with an URL that matches the TRAIL_URL argument. If the working copy is unusual the version number will be more complex:

4123:4168 mixed revision working copy
4168M modified working copy
4123S switched working copy
4123:4168MS mixed revision, modified, switched working copy

If invoked on a directory that is not a working copy, an exported directory say, the program will output 'exported'.

If invoked without arguments WC_PATH will be the current directory.

Valid options: -n [--no-newline] : do not output the trailing newline -c [--committed] : last changed rather than current revisions -h [--help] : display this help --version : show version information

这篇关于将当前 svn 版本写入文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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