svn log — 显示提交日志信息。
缺省目标是你的当前目录的路径,如果没有提供参数,svn log会显示当前目录下的所有文件和目录的日志信息,你可以通过指定路径来精炼结果,一个或多个修订版本,或者是任何两个的组合。对于本地路径的缺省修订版本范围BASE:1
。
如果你只是指定一个URL,就会打印这个URL上所有的日志信息,如果添加部分路径,只有这条路径下的URL信息会被打印,URL缺省的修订版本范围是HEAD:1
。
svn log使用--verbose
选项也会打印所有影响路径的日志信息,使用--quiet
选项不会打印日志信息正文本身(这与--verbose
协调一致)。
每个日志信息只会打印一次,即使是那些明确请求不止一次的路径,日志会跟随在拷贝过程中,使用--stop-on-copy
可以关闭这个特性,可以用来监测分支点。
--revision (-r) REV --quiet (-q) --verbose (-v) --targets FILENAME --use-merge-history (-g) --change (-c) --stop-on-copy --incremental --limit (-l) NUM --with-all-revprops --with-revprop ARG --xml --username USER --password PASS --no-auth-cache --non-interactive --config-dir DIR
你可以在顶级目录运行svn log看到工作拷贝中所有修改的路径的日志信息:
$ svn log ------------------------------------------------------------------------ r20 | harry | 2003-01-17 22:56:19 -0600 (Fri, 17 Jan 2003) | 1 line Tweak. ------------------------------------------------------------------------ r17 | sally | 2003-01-16 23:21:19 -0600 (Thu, 16 Jan 2003) | 2 lines …
检验一个特定文件所有的日志信息:
$ svn log foo.c ------------------------------------------------------------------------ r32 | sally | 2003-01-13 00:43:13 -0600 (Mon, 13 Jan 2003) | 1 line Added defines. ------------------------------------------------------------------------ r28 | sally | 2003-01-07 21:48:33 -0600 (Tue, 07 Jan 2003) | 3 lines …
如果你手边没有工作拷贝,你可以查看一个URL的日志:
$ svn log http://svn.red-bean.com/repos/test/foo.c ------------------------------------------------------------------------ r32 | sally | 2003-01-13 00:43:13 -0600 (Mon, 13 Jan 2003) | 1 line Added defines. ------------------------------------------------------------------------ r28 | sally | 2003-01-07 21:48:33 -0600 (Tue, 07 Jan 2003) | 3 lines …
If you want several distinct paths underneath the
same URL, you can use the URL [PATH...]
syntax:
$ svn log http://svn.red-bean.com/repos/test/ foo.c bar.c ------------------------------------------------------------------------ r32 | sally | 2003-01-13 00:43:13 -0600 (Mon, 13 Jan 2003) | 1 line Added defines. ------------------------------------------------------------------------ r31 | harry | 2003-01-10 12:25:08 -0600 (Fri, 10 Jan 2003) | 1 line Added new file bar.c ------------------------------------------------------------------------ r28 | sally | 2003-01-07 21:48:33 -0600 (Tue, 07 Jan 2003) | 3 lines …
The --verbose
option causes
svn log to include information about
the paths that were changed in each displayed revision.
These paths appear, one path per line of output, with
action codes that indicate what type of change was made to
the path.
$ svn log -v http://svn.red-bean.com/repos/test/ foo.c bar.c ------------------------------------------------------------------------ r32 | sally | 2003-01-13 00:43:13 -0600 (Mon, 13 Jan 2003) | 1 line Changed paths: M /foo.c Added defines. ------------------------------------------------------------------------ r31 | harry | 2003-01-10 12:25:08 -0600 (Fri, 10 Jan 2003) | 1 line Changed paths: A /bar.c Added new file bar.c ------------------------------------------------------------------------ r28 | sally | 2003-01-07 21:48:33 -0600 (Tue, 07 Jan 2003) | 3 lines …
There are just a handful of action codes used by svn log, and they are similar to the ones used by the svn update command:
A
The item was added.
D
The item was deleted.
M
Properties or textual contents on the item were changed.
R
The item was replaced by a different one at the same location.
In addition to the action codes which precede the
changed paths, svn log --verbose will
note a path was added or replaced as the result of a copy
operation. It does so by printing (from
after such paths.COPY-FROM-PATH
:COPY-FROM-REV
)
当你想连接多个对日志命令的调用结果,你会希望使用--incremental
选项。svn log通常会在日志信息的开头和每一小段间打印一行虚线,如果你对一段修订版本运行svn log,你会得到下面的结果:
$ svn log -r 14:15 ------------------------------------------------------------------------ r14 | ... ------------------------------------------------------------------------ r15 | ... ------------------------------------------------------------------------
However, if you wanted to gather two nonsequential log messages into a file, you might do something like this:
$ svn log -r 14 > mylog $ svn log -r 19 >> mylog $ svn log -r 27 >> mylog $ cat mylog ------------------------------------------------------------------------ r14 | ... ------------------------------------------------------------------------ ------------------------------------------------------------------------ r19 | ... ------------------------------------------------------------------------ ------------------------------------------------------------------------ r27 | ... ------------------------------------------------------------------------
You can avoid the clutter of the double dashed lines
in your output by using the --incremental
option:
$ svn log --incremental -r 14 > mylog $ svn log --incremental -r 19 >> mylog $ svn log --incremental -r 27 >> mylog $ cat mylog ------------------------------------------------------------------------ r14 | ... ------------------------------------------------------------------------ r19 | ... ------------------------------------------------------------------------ r27 | ...
The --incremental
option provides
similar output control when using the
--xml
option:
$ svn log --xml --incremental -r 1 sandwich.txt <logentry revision="1"> <author>harry</author> <date>2008-06-03T06:35:53.048870Z</date> <msg>Initial Import.</msg> </logentry>
If you run svn log on a specific path and provide a specific revision and get no output at all as in the following:
$ svn log -r 20 http://svn.red-bean.com/untouched.txt ------------------------------------------------------------------------
That just means that the path was not modified in that revision. If you log from the top of the repository or know the file that changed in that revision, you can specify it explicitly:
$ svn log -r 20 touched.txt ------------------------------------------------------------------------ r20 | sally | 2003-01-17 22:56:19 -0600 (Fri, 17 Jan 2003) | 1 line Made a change. ------------------------------------------------------------------------