Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get a pager in svn diff?

Tags:

diff

svn

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.)

like image 693
zoul Avatar asked Sep 08 '10 06:09

zoul


People also ask

How do you find the difference between two svn revisions?

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.

How does svn diff work?

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.


2 Answers

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
}
like image 154
schot Avatar answered Sep 25 '22 00:09

schot


I usually run svn diff | vim -.

like image 31
Edson Medina Avatar answered Sep 25 '22 00:09

Edson Medina