svnversion — 总结工作副本的本地修订版本。
svnversion is a program for summarizing the revision mixture of a working copy. The resultant revision number, or revision range, is written to standard output.
通常在构建过程中利用其输出定义程序的版本号码。
TRAIL_URL
, if present, is the trailing portion of
the URL used to determine whether WC_PATH
itself
is switched (detection of switches within WC_PATH
does not rely on TRAIL_URL
).
When WC_PATH
is not defined, the current
directory will be used as the working copy path.
TRAIL_URL
cannot be defined if
WC_PATH
is not explicitly given.
Like svnserve, svnversion has no subcommands—only options:
--no-newline
(-n
)
忽略输出的尾端新行。
--committed
(-c
)
使用最后修改的版本而不是当前的(例如,本地存在的最高修订版本)版本。
--help
(-h
)
打印帮助摘要。
--version
打印 svnversion 的版本,无错退出。
如果工作副本都是一样的修订版本(例如,在更新后那一刻),打印的修订版本是:
$ svnversion 4168
You can add TRAIL_URL
to make sure the working
copy is not switched from what you expect. Note that the
WC_PATH
is required in this command:
$ svnversion . /var/svn/trunk 4168
对于混合修订版本的工作副本,修订版本的范围会被打印:
$ svnversion 4123:4168
如果工作副本包含修改,尾部会增加'M
':
$ svnversion 4168M
如果工作副本已经切换,尾部会增加'S
':
$ svnversion 4168S
svnversion will also inform you if the target working
copy is sparsely populated (see 第 7 节 “稀疏目录”)
by attaching the 'P
' code to its output:
$ svnversion 4168P
Thus, here is a mixed-revision, sparsely populated and switched working copy containing some local modifications:
$ svnversion 4123:4168MSP
If invoked on a directory that is not a working copy, svnversion assumes it is an exported working copy and prints “exported”:
$ svnversion exported