I’d like svn diff
to display colored diff through a pager (just like git does). I’ve succeeded to get a colored diff by setting the diff-cmd
in ~/.subversion/config
:
diff-cmd = colordiff
Now I’d like to pipe the diff output through a pager, how do I do that? (Short of writing svn diff | less
, of course.)
Use just svn diff'to display local modifications in a working copy. Display the changes made to TARGET s as they are seen in REV between two revisions. TARGET s may be all working copy paths or all URL s.
If the alternate syntax is used, the server compares URL1 and URL2 at revisions N and M , respectively. If either N or M is omitted, a value of HEAD is assumed. By default, svn diff ignores the ancestry of files and merely compares the contents of the two files being compared.
In the past I've used a wrapper script and set diff-cmd
to this script:
#!/bin/sh
colordiff "$@" | less -r
But then you get a separate pager for every file, I'm not sure if this is what you want. Nowadays I just write svn diff | less
.
Another easy solution is making an alias: alias svndiff='svn diff | less'
. Or if you want to use svn diff
, make a shell function:
svn() {
if [ x"$1" = xdiff ] || [ x"$1" = xdi ]; then
/usr/bin/svn "$@" | less -r
else
/usr/bin/svn "$@"
fi
}
I usually run svn diff | vim -
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With