[PATCH] filemerge: add $revbase and $revother substitutions in merge tool arguments

Vitaliy Filippov vitalif at yourcmc.ru
Tue Jul 31 17:58:07 CDT 2012


# HG changeset patch
# User Vitaliy Filippov <vitalif at yourcmc.ru>
# Date 1342116873 -14400
# Node ID b861c6e313334007cc55462e473c4c2c8ad549c9
# Parent  3ac9592b7ab432e1470ec97d19c9b7c58c3fda86
filemerge: add $revbase and $revother substitutions in merge tool arguments

Usage example:

[merge-tools]
filemerge.executable = /usr/bin/merge
filemerge.args = -L local -L "base (rev $revbase)" -L "other (rev $revother)" -A $local $base $other

diff -r 3ac9592b7ab4 -r b861c6e31333 mercurial/filemerge.py
--- a/mercurial/filemerge.py	Thu Jul 12 14:20:34 2012 -0500
+++ b/mercurial/filemerge.py	Thu Jul 12 22:14:33 2012 +0400
@@ -254,8 +254,11 @@
         if "$output" in args:
             out, a = a, back # read input from backup, write to original
         replace = dict(local=a, base=b, other=c, output=out)
-        args = util.interpolate(r'\$', replace, args,
-                                lambda s: '"%s"' % util.localpath(s))
+        for i in replace:
+            replace[i] = '"%s"' % util.localpath(replace[i])
+        replace['revbase'] = str(fca.rev())
+        replace['revother'] = str(fco.rev())
+        args = util.interpolate(r'\$', replace, args)
         r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env,
                         out=ui.fout)
         return True, r


More information about the Mercurial-devel mailing list