svn log
Name
svn log — Display commit log messages.
Synopsis
svn log [PATH]
svn log URL[@REV] [PATH...]
Description
Shows log messages from the repository.
If no arguments are supplied, svn
log shows the log messages for all files and
directories inside (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, it prints log
messages for everything 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
(-v
), svn log will
also print all affected paths with each log message.
With --quiet
(-q
), svn log will not
print the log message body itself, this is compatible
with --verbose
(-v
).
Each log message is printed just once, even if more
than one of the affected paths for that revision were
explicitly requested. Logs follow copy history by
default. Use --stop-on-copy
to disable
this behavior, which can be useful for determining branch
points.
Options
--change
(-c
)ARG
--depth
ARG
--diff
--diff-cmd
CMD
--extensions
(-x
)ARG
--incremental
--internal-diff
--limit
(-l
)NUM
--quiet
(-q
)--revision
(-r
)REV
--search
ARG
--search-and
ARG
--stop-on-copy
--targets
FILENAME
--use-merge-history
(-g
)--verbose
(-v
)--with-all-revprops
--with-no-revprops
--with-revprop
ARG
--xml
Examples
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 …
Examine all log messages for a particular file in your working copy:
$ 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 …
If you don't have a working copy handy, you can log a 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
(-v
)
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 …
svn log uses just a handful of action codes, and they are similar to the ones the svn update command uses:
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 with
the --verbose
(-v
)
option will note whether 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
)
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 | … ------------------------------------------------------------------------
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>
Sometimes when you run svn log on a specific path and a specific revision, you see no log information output at all, as in the following:
$ svn log -r 20 http://svn.red-bean.com/untouched.txt ------------------------------------------------------------------------
That just means the path wasn't modified in that revision. To get log information for that revision, either run the log operation against the repository's root URL, or specify a path that you happen to know was changed in that revision:
$ svn log -r 20 touched.txt ------------------------------------------------------------------------ r20 | sally | 2003-01-17 22:56:19 -0600 (Fri, 17 Jan 2003) | 1 line Made a change. ------------------------------------------------------------------------
Beginning with Subversion 1.7, users can take
advantage of a special output mode which combines the
information from svn log with what you
would see when running svn diff on the
same targets for each revision of the log. Simply
invoke svn log with
the --diff
option to trigger this output
mode.
$ svn log -r 20 touched.txt --diff ------------------------------------------------------------------------ r20 | sally | 2003-01-17 22:56:19 -0600 (Fri, 17 Jan 2003) | 1 line Made a change. Index: touched.txt =================================================================== --- touched.txt (revision 19) +++ touched.txt (revision 20) @@ -1 +1,2 @@ This is the file 'touched.txt'. +We add such exciting text to files around here! ------------------------------------------------------------------------ $
As with svn diff, you may also make
use of many of the various options which control the way
the difference is generated,
including --depth
, --diff-cmd
,
and --extensions
(-x
).
Beginning with Subversion 1.8, users can filter svn log
output using --search
and --search-and
options. When using these options, a log message is shown only if a
revision's author, date, log message text, or list of changed paths,
matches a search pattern. Searching by changed patch requires
--verbose
option, otherwise svn log
does not show changed paths therefore they can't be filtered.
The search pattern (also called glob or shell wildcard pattern) can contain regular characters and the following wildcard characters:
-
?
Matches any single character.
-
*
Matches a sequence of arbitrary characters.
-
[ABC]
Matches any of the characters listed inside the brackets.
Using multiple --search
parameters will show
log messages that match the pattern specified at least in one of the
options. For example:
$ svn log --search sally --search harry https://svn.red-bean.com/repos/test ------------------------------------------------------------------------ r1701 | sally | 2011-10-12 22:35:30 -0600 (Wed, 12 Oct 2011) | 1 line Add a reminder. ------------------------------------------------------------------------ r1564 | harry | 2011-10-09 22:35:30 -0600 (Sun, 09 Oct 2011) | 1 line Merge r1560 to the 1.0.x branch. ------------------------------------------------------------------------ $
Using --search
with --search-and
options will show log messages
that match the combined pattern from both options. For example:
$ svn log --verbose --search sally --search-and /foo/bar https://svn.red-bean.com/repos/test ------------------------------------------------------------------------ r1555 | sally | 2011-07-15 22:33:14 -0600 (Fri, 15 Jul 2011) | 1 line Changed paths: M /foo/bar/src.c Typofix. ------------------------------------------------------------------------ r1530 | sally | 2011-07-13 07:24:11 -0600 (Wed, 13 Jul 2011) | 1 line Changed paths: M /foo/bar M /foo/build Fix up some svn:ignore properties. ------------------------------------------------------------------------ $
--search
and --search-and
options does not actually perform a search. They just filter
the svn log output to display only log
messages that match the specified pattern. Therefore, if
--limit
is used, it restricts the number
of log messages searched, rather than restricting the
output to a particular number of matching log messages.