Independent differential VCS

Instead of running svn diff, hg diff, etc., can we write a single command that calls svn / hg / git accordingly? Is it possible to conclude diff?

edit : command line tools (not GUIs) are preferred.

+4
source share
3 answers

Typing "svn diff" or "hg diff" is not fun if you had to type it again, just to print the result with less. In addition, when it is likely that your text editor does syntax highlighting .. there is no reason why the output of diff in the terminal should also not be highlighted in appropriate colors.

alt text http://img25.imageshack.us/img25/8597/colordiff.png

You will need colordiff , which can be installed via apt or macports.

The following bash function will allow you to enter just `dif 'into the VCS working directory of your choice (no need to indicate whether it is hg or svn).

function dif { if [ -d .hg ]; then VC='hg' elif [ -d .svn ]; then VC='svn' else echo "cannot find VC type" return 1 fi $VC diff $1 | colordiff | less -R } 

You cannot add support for other VCS tools (git, cvs, etc.)

Also, if you installed UVC (according to Ryan Wilcox's answer), the above script can be simplified as:

 function dif { uvc diff $1 | colordiff | less -R } 
+3
source

There is also a series of "wrap all common VCS commands in one utility." pyvcs and UVC are two that come to mind. Maybe they will do what you want?

+3
source

Try Diffuse . It will find a suitable version control system and display diff with beautiful syntax highlighting.

0
source

All Articles