Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get visual diff of two revisions of a file

Tags:

I'd like to know the best/easiest way to get a visual diff of a file given two revisions in Mercurial. I.e., I'd like to visualize the difference between revision 3 and revision 12, etc.

like image 680
Steve Horn Avatar asked Mar 17 '10 03:03

Steve Horn


2 Answers

If by 'visual' you mean a text comparison you can do:

hg diff -r 3 -r 12

If you want a GUI tools you can easily configure and use the ExtDiff extension, which comes with Mercurial, and use:

hg yourdiff -r 3 -r 12

where yourdiff was configured in your hgrc file.

like image 83
Ry4an Brase Avatar answered Sep 23 '22 06:09

Ry4an Brase


In the 'better late than never' category, and in answer to epalm's comment, here is how to compare any two revisions of a file from within TortoiseHG.

From any view that displays the file of interest, right click on the file and select 'File History'. This will open a new window that only displays check-ins for that file. (If the file you want is not visible in the current change set, remember that all files are visible in the Manifest view.)

From the File History window, select the two revisions that you want to compare by doing a CTRL - Left Click on each one. Make sure exactly two revisions are selected or you won't see the context menu you need in the next step.

Right click on one of the selected file and choose the "Diff selected file revisions..." option. A file diff window will open with whatever diff tool TortoiseHG is configured to use.

Note that this answer was written based on TortoiseHG version 2.6.2

like image 23
Brad Oestreicher Avatar answered Sep 24 '22 06:09

Brad Oestreicher