How do you get a pager in svn diff?

cli color diff
diff highlight difference
diff with color mac
ubuntu diff-highlight
diff command colors
diff color coding
terminal colored diff
ubuntu diff colors

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

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
}

How do you get a pager in svn diff?, 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:  working on trunk), you can use the explorer context menu. Just hold down the Shiftkey while you right click on the file. Then select TortoiseSVN→ Diff with URL. In the following dialog, specify the URL in the repository with which you want to compare your local

I usually run svn diff | vim -.

Piping copious output to PAGER automatically., temporarily set to nothing, as in "PAGER= svn diff". I first came across this function in Rick Faith's dict.org client program, and have since found it  If you use --notice-ancestry, the ancestry of the paths in question will be taken into consideration when comparing revisions (i.e., if you run svn diff on two files with identical contents but different ancestry, you will see the entire contents of the file as having been removed and added again).

Adding

function sdi ()
{
    if tty -s; then
            exec svn diff --diff-cmd=colordiff "$@" | less -R
    else
            exec svn diff --diff-cmd=colordiff "$@"
    fi
}

to my ~/.bashrc did the trick for me. Taken from here

Colored SVN diff Using diff, vim, My favorite is to pipe it to less: svn diff file.c | colordiff | less -R that way you can use a pager to peruse the diff if it's longer than a screenful. Sometimes you might need Subversion to interpret a patch “ in reverse ” —where added things get treated as removed things, and vice-versa. Use the --reverse-diff option for this purpose. In the following example, we'll squirrel away a patch file which describes the changes in our working copy, and then use a reverse patch operation to

This would've been a comment, but I don't have enough rep. An improvement on schot's answer is to also fail before piping to less if the svn command fails for any reason, for example if you specify a file that doesn't exist. It also passes through the error code as well.

And this answer also adds progress format:

EDIT: An additional approvement is when piping/redirecting output to not use colordiff. To do this, do not change ~/.subversion/config and instead we need to use the --diff-cmd option.

function svn() {
    if [[ "$1" == "diff" && -t 1 ]]; then
        output=$(/usr/bin/svn --diff-cmd=colordiff "$@") || return $?
        [ "${output}" != "" ] && less -rM +Gg <<< "${output}";
    else
        /usr/bin/svn "$@"
    fi
}

Color highlighted diffs with git, svn and cvs, At first it felt annoying, but now I really like that git uses a pager when it has to present something (e.g. a log or a diff) that is longer than your  svn is the official command-line client of Subversion. Its functionality is offered via a collection of task-specific subcommands, most of which accept a number of options for fine-grained control of the program's behavior.

Generate SVN diffs from git. Checkout should be done via git svn , via git svn. Dependencies: git subversion python3 (could work with 2 too) - git-​svn-diff.py. a svn diff. # We use --no-pager as git diff will use a pager by default. Now you can do svn list and check whether the file was deleted from the repository. 6. SVN Diff – Display the difference. SVN diff displays the differences between your working copy and the copy in the SVN repository. You can find the difference between two revisions and two paths etc., Syntax: $ svn diff filename $ svn -r R1:R2 diff filename

ymattw/ydiff: View colored, incremental diff in workspace or , Term based tool to view colored, incremental diff in a version controlled Svn so far) or from stdin, with side by side (similar to diff -y ) and auto pager support. If you use --notice-ancestry, the ancestry of the paths in question will be taken into consideration when comparing revisions (that is, if you run svn diff on two files with identical contents but different ancestry you will see the entire contents of the file as having been removed and added again).

Colored word-based diff, diff is the standard utility for displaying differences between text files. This wrapper could replace cwdiff in the above wrappers for bzr and svn. zsh configuration file contains a global alias for conveniently paging through colorized output: The svn delete command will delete a file from your working copy of the repository. svn list. The svn list command allows you to see a list of files in a repository without creating a working copy. svn diff. The svn diff command reveals the differences between your working copy and the copy in the master SVN repository. svn status

Comments
  • Good answer here (different less options to one below).
  • Original answer used vimdiff but this isn't any more useful that vim and shows an annoying fold bar on the left of the screen.
  • @AlastairIrvine The question asks specifically for a coloured diff pager. Vim standalone doesn't do that. Vimdiff shows side-by-side diff which is very useful.
  • Vimdiff doesn't do anything special in this case, like I said. For Vimdiff to work it needs two files.
  • Fair enough @AlastairIrvine