This documentation was written to describe the 1.7.x series of Apache™ Subversion®. If you are running a different version of Subversion, you are strongly encouraged to visit http://www.svnbook.com/ and instead consult the version of this documentation appropriate for your version of Subversion.
svn blame (praise, annotate, ann) — Show author and revision information inline for the specified files or URLs.
Show author and revision information inline for the specified files or URLs. Each line of text is annotated at the beginning with the author (username) and the revision number for the last change to that line.
If you want to see blame-annotated source for
readme.txt
in your test
repository:
$ svn blame http://svn.red-bean.com/repos/test/readme.txt 3 sally This is a README file. 5 harry Don't bother reading it. The boss is a knucklehead. 3 sally …
Now, just because svn blame says
that Harry last modified readme.txt
in revision 5, understand that this subcommand is by
default very picky about what constitutes a change.
Before clubbing Harry over the head for what appears to be
insubordination, first consider that perhaps the change he
made to the file might have been only to its specific
character content, not to its overall semantic meaning.
Perhaps his changes were the result of blindly running a
whitespace cleanup script on this file. You might need
to examine the specific differences and related log
message to understand exactly what Harry did to this file
in revision 5.
$ svn log -c 5 http://svn.red-bean.com/repos/test/readme.txt ------------------------------------------------------------------------ r5 | harry | 2008-05-29 07:26:12 -0600 (Thu, 29 May 2008) | 1 line Commit the results of 'double-space-after-period.sh'. ------------------------------------------------------------------------ $ svn diff -c 5 http://svn.red-bean.com/repos/test/readme.txt Index: http://svn.red-bean.com/repos/test/readme.txt =================================================================== --- http://svn.red-bean.com/repos/test/readme.txt (revision 4) +++ http://svn.red-bean.com/repos/test/readme.txt (revision 5) @@ -1,5 +1,5 @@ This is a README file. -Don't bother reading it. The boss is a knucklehead. +Don't bother reading it. The boss is a knucklehead. INSTRUCTIONS ============ $
Sure enough, Harry only changed the whitespace in that
line. Fortunately, the --extensions
(-x
) option can help you better determine
the last time that a meaningful
change was made to a given line of text. For example,
here's how you can see the annotation information while
disregarding mere whitespace changes:
$ svn blame -x -b http://svn.red-bean.com/repos/test/readme.txt 3 sally This is a README file. 4 jess Don't bother reading it. The boss is a knucklehead. 3 sally …
If you use the --xml
option, you can
get XML output describing the blame annotations, but not
the contents of the lines themselves:
$ svn blame --xml http://svn.red-bean.com/repos/test/readme.txt <?xml version="1.0"?> <blame> <target path="readme.txt"> <entry line-number="1"> <commit revision="3"> <author>sally</author> <date>2008-05-25T19:12:31.428953Z</date> </commit> </entry> <entry line-number="2"> <commit revision="5"> <author>harry</author> <date>2008-05-29T13:26:12.293121Z</date> </commit> </entry> <entry line-number="3"> … </entry> </target> </blame> $