Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can you add annotate/blame-alike information to svn diff, so that for every changed line it includes which user and revision changed that line?

For example, an annotate-diff comparing revisions 8-10 could output something like:

9    user1   - some line that user1 deleted in revision 9
10   user2   + some line that user2 added in revision 10

The context, lines around it which haven't changed, may be included as well or not, doesn't matter.

It's not just a matter of "quickly" writing a shell script combining the output of svn diff and svn annotate. annotate for example will never show you who removed a line. It's also not a matter of doing annotate on a revision in the past: We're not interested in who originally added the line that got removed (that's not the one who "caused" the diff), we want to know who removed it. I suspect the only way to implement something to do this is to inspect each and every commit between the two revisions being compared (and somehow map all the changes in the separate diffs to lines in the total diff)...

Does there exist a tool that does something like that?

share|improve this question

I am not entirely sure i understood exactly what you want, but i did this with TortoiseSVN:

  1. Create Blame from revision 1 to revision A - save as A.txt
  2. Create Blame from revision 1 to revision B - save as B.txt
  3. Remove first column (line) from both text files (i used Pspad editor, which can delete a column of a text file)
  4. Merge A.txt and B.txt (TortoiseMerge.exe /base:"a.txt" /mine:"b.txt" )

It shows changed, added and removed lines between revisions A and B together with date, user and branch, i think that is what you wanted.

share|improve this answer
That would fall into the same category as the "a shell script combining the output of svn diff and svn annotate" I mentioned, and has the same problem: For lines that were removed, it shows you who originally added the line, not who removed it. – Wouter Coekaerts Jun 28 '11 at 10:42

SVN diff takes exactly two revisions and generates output on the fly. SVN annotate takes exactly one revision. Your suspicion that the proposed utility will need to iterate over N revisions is correct; SVN stores revision states as whole objects.

You might have better luck with git and the git-svn gateway...

share|improve this answer

In your basic vanilla SVN setup there is no command which can merge the outputs of blame and diff on a particular revision. If you specified the particular SVN client you used I might have been able to find a plugin that does this, but you didn't so I couldn't search for one.

The only alternative is to use a script or small program to match up the two outputs. This shouldn't be so hard if you can get line numbers on diff and blame. Even though this isn't the answer you were hoping for it is an answer and this question has sat open since 2009.

share|improve this answer
I didn't specify a particular SVN client because it doesn't matter: I'd be happy to (just when I need this feature) use any other client. – Wouter Coekaerts Dec 11 '10 at 12:22
As I already said in the description, it's not just a matter of matching up the output of a diff and and an annotate. It looks like it's a matter of merging a series of patches into one, while keeping track of which change came from which diff (and the committer of that diff). That is definitely not an easy task. Sorry, but claiming it's easy is not really an answer to the question of how to do it. – Wouter Coekaerts Dec 11 '10 at 12:27

This isn't quite what you were after, but you can get an annotated view of changes in OpenGrok.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .