views:

56

answers:

2

We used to use Visual Source Safe and there was one neat feature that I can't find in TortoiseHG. You right click on a file and click "Show history". VSS opens a list of versions for that file. Then you select two versions (ie: version 50 and version 47) and click the compare button to launch a visual diff of the two versions.

How can I do that with Mercurial/TortoiseHG? I saw the annotate feature but only compares consecutive versions of a file.

+2  A: 

You can do that in TortoiseHG's Repository Explorer:
Mark one version, right-click on another version and a context menu will pop up.
In that context menu, choose "Visual Diff with Selected".

EDIT:
@Sly:
Instead of using the filter box, you could right-click on class1.cs in the Windows Explorer and open the Repository Explorer from there. When you do that, the filter is already active and you see only the changesets where class1.cs was involved.
This makes step 1 much easier (at least in my opinion, I always do it that way) AND it completely eliminates step 4 and 5 (the list doesn't appear at all since there is only one file to diff).

haarrrgh
That's not bad but the process is rather lengthy. Let's say I want to see recent changes for class1.cs and compare versions. I have to: 1) Use filter box to find changesets that involve class1.cs 2) Click a changeset 3) Locate another changeset and right click "Visual Diff with Selected" 4) Locate class1.cs in the Visual Diffs window (there could be 150 files listed there and they are not sorted). 5) Double-click class1.cs to open the visual diff. Step 4 is really painful. Is there a faster way to do that?
Sly
I edited my answer, see above!
haarrrgh
Yep that is exactly what I need. Note that @Paul Nathan's answer works pretty good too. I'll wait until tomorrow to accept your answer in case someone posts an even simpler answer.
Sly
Even simpler than five clicks? ;-)
haarrrgh
I know, we'll see....
Sly
+1  A: 

I've found it faster to do the below than to fiddle with TortoiseHG for the purpose you describe.

Install Winmerge at the default location;

Then, modify your global hgrc to have this. (Mercurial.ini in Windows)

[extdiff]
cmd.guidiff = C:\Program Files\WinMerge\WinMergeU.exe

And, then,

hg guidiff -r rev1 -r rev2

on the command-line.

Note that you can use kdiff3 or whatever as your GUI diff client.

Paul Nathan
That's nice. Let's say I want to see recent changes for class1.cs and compare versions. I'd: 1) `hg log -I **class1.cs -l 10` to see recent changes for class1. 2) Locate the revs I want to compare. 3) `hg guidiff -r 535 -r 500 -I **class1.cs` to open the diff for that specific file.
Sly
@Sly: yep. You won't need those ** though I don't believe.
Paul Nathan