How to start visual diff of working copy and last commit of a file from command line in mercurial TortoiseHg

StackOverflow https://stackoverflow.com/questions/17869237

Question

Provided that I already know that a file has been modified in a mercurial repo, Is there any way to start a diff tool in command line to show the visual diff of the file between working copy and commit.

Little background: I`m trying to add a External Tool for QT which will help me see currently open file's working copy changes in a diff tool in click of a button without going and opening the repo in TortoiseHg, waiting for it to load (big repo, lot of time), then right clicking modified file to select view visual diff

To those who are NOT familiar with the setup, I have: full path of the hg repo and modified file, I need: a linux command to open the diff between working copy and last commit of the file in a diff tool

My setup: Linux, QT, TortoiseHg, Sourcegear DiffMerge

Is this possible?

Was it helpful?

Solution

I assume you have the ability to edit one of the config files to enable extensions, such as the .hgrc file. If that is true, then as described here or here you can add the following (and ensure the path to diffmerge is correct):

[ui]
merge = diffmerge

[extensions]
hgext.extdiff =

[extdiff]
cmd.diffmerge = /usr/bin/diffmerge

[merge-tools]
diffmerge.executable = /usr/bin/diffmerge
diffmerge.args = -merge -result=$output -t1="Local Version" -t2=$output -t3="Other Version" -caption=$output $local $base $other
diffmerge.binary = False
diffmerge.symlinks = False
diffmerge.gui = True

Since you only asked to add it to diff between files and not for merging, you may only need the following sections (which excludes the merge functions) :

[extensions]
hgext.extdiff =

[extdiff]
cmd.diffmerge = /usr/bin/diffmerge
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top