svn log — 显示提交日志信息。
Shows log messages from the repository.
If no arguments are supplied, svn
log shows the log messages for all files and
directories inside of (and including) the current working
directory of your working copy. You can refine the
results by specifying a path, one or more revisions, or
any combination of the two. The default revision range
for a local path is BASE:1.
If you specify a URL alone, then it prints log
messages for everything that the URL contains. If you
add paths past the URL, only messages for those paths
under that URL will be printed. The default revision range
for a URL is HEAD:1.
With --verbose, svn log
will also print all affected paths with each log message.
With --quiet, svn log
will not print the log message body itself (this is
compatible with --verbose).
每个日志信息只会打印一次,即使是那些明确请求不止一次的路径,日志会跟随在拷贝过程中,使用--stop-on-copy可以关闭这个特性,可以用来监测分支点。
--revision (-r) REV --quiet (-q) --verbose (-v) --targets FILENAME --stop-on-copy --incremental --limit NUM --xml --username USER --password PASS --no-auth-cache --non-interactive --config-dir DIR
You can see the log messages for all the paths that changed in your working copy by running svn log from the top:
$ 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 …
When you're concatenating the results of multiple
calls to the log command, you may want to use the
--incremental option. svn
log normally prints out a dashed line at the
beginning of a log message, after each subsequent log
message, and following the final log message. If you
ran svn log on a range of two
revisions, you would get this:
$ svn log -r 14:15 ------------------------------------------------------------------------ r14 | ... ------------------------------------------------------------------------ r15 | ... ------------------------------------------------------------------------
然而,如果你希望收集两个不连续的日志信息到一个文件,你会这样做:
$ 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.
If you run svn log on a specific path and provide a specific revision and get no output at all
$ svn log -r 20 http://svn.red-bean.com/untouched.txt ------------------------------------------------------------------------
这只意味着这条路径在那个修订版本没有修改,如果从版本库的顶级目录运行这个命令,或者是你知道那个修订版本修改了那个文件,你可以明确的指定它:
$ svn log -r 20 touched.txt ------------------------------------------------------------------------ r20 | sally | 2003-01-17 22:56:19 -0600 (Fri, 17 Jan 2003) | 1 line Made a change. ------------------------------------------------------------------------