Skip to content

Instantly share code, notes, and snippets.

@orenhe
Created May 20, 2012 07:22
Show Gist options
  • Select an option

  • Save orenhe/2757173 to your computer and use it in GitHub Desktop.

Select an option

Save orenhe/2757173 to your computer and use it in GitHub Desktop.
SVN Log P: a partial 'git log -p' for SVN
#!/bin/bash
# svnlogp is a script that implements 'git log -p' for svn (partially & inefficiently): it shows all the diff's of a given filename.
#
# Due the SVN centralized architecture, it's really slow, and 'svn blame' is commonly a fair alternative.
#
# Usage: svnlogp <filename>
#
# Author: Oren Held
filename=$1
if [ "$filename" == "" ]; then
echo "Usage: $0 <filename>"
exit
fi
for revision in $(svn log ${filename} | grep ^r | awk '{print $1}'); do
revision_i=$(echo ${revision} | cut -dr -f2)
echo Revision: ${revision}
prev_revision_i=`expr ${revision_i} - 1`
svn diff -r${prev_revision_i}:${revision_i} ${filename}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment