0

Looking for a program, or script, I can use to easily 'walk' through an SVN revision history for a specific file. Anyone know if this exists? Can I achieve this with the command line client for svn?

What I'd like to be able to do:

  • request diff for file between revision x and x-1 (I use a script that show me the diff in vimdiff, similar to this:http://tierseven.net/wiki/index.php?title=Svndiff.sh )
  • while staying inside vimdiff, call 'next' or 'prev' command, and show me diff between x and x-2, or between x-1 and x-2

I'd rustle something up in bash/sed/awk, but I'd rather use something that already exists.

2 Answers 2

1

svn log -q -v filename and processing output for revlist

svn diff -c M filename for changes in filename in revision M

0
svn log FILENAME_GOES_HERE --limit 20 | grep -P 'r\d+ \|' | sed s/^r// | sed s/\ .*// | xargs -L 1 svn diff DancerAdmin/templates/Common/inputs/ss-dropdown.html -c | less

There's probably a better way to do it with awk instead of sed, or even a better way to do it with sed, but this works.

Outputs the last 20 versions of this file to less. From there, you can search for Index: (/Index:[Enter]) and then use n/N to "page" up and down through the revision history.

Just to explain what's going on here;

  1. svn log to get a list of revisions where the file is modified.
  2. grep for lines with the revision number in it.
  3. sed to strip out all the other info from the line, leaving just the revision numbers.
  4. xargs (with -L 1) to repeatedly get the diff for the file from each specific revision, and finally...
  5. less to make it "navigable"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.