Get visual diff of two revisions of a file

11,748

Solution 1

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.

Solution 2

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

Share:
11,748
Steve Horn
Author by

Steve Horn

Problem solver and lifetime learner; everything I do is driven by a desire to help people and make them more successful. As a software engineer, I am focused on ubiquitous Internet technologies such as HTTP, Javascript, CSS, HTML5, Android, and iOS. Dabbled in many front-end javascript frameworks, but most comfortable with ReactJS and KendoUI. Experienced with nearly every popular relational database system. Productive writing internet server-side software using C#/MVC (.Net), Ruby/Rails, NodeJS. Enthusiast of open source geospatial technologies such as PostGIS, OpenLayers and pgRouting. Actively learning and pursuing education about Artificial Intelligence (Machine Learning/Statistics).

Updated on June 05, 2022

Comments

  • Steve Horn
    Steve Horn about 2 years

    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.

  • epalm
    epalm about 13 years
    I'd like to do exactly this, but from TortoiseHG's Repository Explorer. I feel like this should be right in front of me but I'm not seeing it.
  • fordareh
    fordareh over 11 years
    Note: "yourdiff" is added using syntax similar to here: mercurial.selenic.com/wiki/KDiff3 ... and can be added to Mercurial.ini file as well