Subversion’s SVN Annotate Command
Apache Subversion’s ‘svn annotate’ command allows users to view a line-by-line breakdown of all the changes that have been applied to a human-readable file in your working copy. This information is printed alongside details on:
- The person responsible for each change
- The revision number where each change occurred
Note that this line-by-line attribution is based on the file as it currently appears within the working copy.
To run ‘svn annotate’ on a file, enter:
svn annotate (working-copy-location)/file-being-examined
In this example, we’re examining all the changes for the ‘Changelog’ file, which is located inside the trunk of our working copy.
If you need a more comprehensive printout, the -verbose (-v) switch adds the full datestamp to each line.
The –force Switch
The ‘svn annotate’ command uses Multipurpose Internet Mail Extensions (MIME) types to automatically detect whether a file is human-readable. By default, ‘svn annotate’ will block any file that’s non human-readable. If you attempt to perform an ‘svn annotate’ on a file that Subversion judges not to be readable, you’ll get an error message.
If you want to go ahead regardless, you can add the –force switch. Of course, this may result in a screen full of strange symbols if the file truly is non human-readable!
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)