[PATCH 3 of 4 marmoute-reviewed] filemerge._xmerge: drop no longer necessary 'if r:' check

Siddharth Agarwal sid0 at fb.com
Thu Oct 8 23:40:34 CDT 2015


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1444339123 25200
#      Thu Oct 08 14:18:43 2015 -0700
# Node ID e550d45ce05dbd503f897b4143c302aded345cdc
# Parent  332c4735884b712e39b862eb15b4ad83fb91cc3c
filemerge._xmerge: drop no longer necessary 'if r:' check

Cleanup from an earlier patch to make premerge be directly called from the main
filemerge function.

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -356,34 +356,31 @@ def _idump(repo, mynode, orig, fcd, fco,
     return False, 1
 
 def _xmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
-    r = 1
-    if r:
-        tool, toolpath, binary, symlink = toolconf
-        a, b, c, back = files
-        out = ""
-        env = {'HG_FILE': fcd.path(),
-               'HG_MY_NODE': short(mynode),
-               'HG_OTHER_NODE': str(fco.changectx()),
-               'HG_BASE_NODE': str(fca.changectx()),
-               'HG_MY_ISLINK': 'l' in fcd.flags(),
-               'HG_OTHER_ISLINK': 'l' in fco.flags(),
-               'HG_BASE_ISLINK': 'l' in fca.flags(),
-               }
+    tool, toolpath, binary, symlink = toolconf
+    a, b, c, back = files
+    out = ""
+    env = {'HG_FILE': fcd.path(),
+           'HG_MY_NODE': short(mynode),
+           'HG_OTHER_NODE': str(fco.changectx()),
+           'HG_BASE_NODE': str(fca.changectx()),
+           'HG_MY_ISLINK': 'l' in fcd.flags(),
+           'HG_OTHER_ISLINK': 'l' in fco.flags(),
+           'HG_BASE_ISLINK': 'l' in fca.flags(),
+           }
 
-        ui = repo.ui
+    ui = repo.ui
 
-        args = _toolstr(ui, tool, "args", '$local $base $other')
-        if "$output" in args:
-            out, a = a, back # read input from backup, write to original
-        replace = {'local': a, 'base': b, 'other': c, 'output': out}
-        args = util.interpolate(r'\$', replace, args,
-                                lambda s: util.shellquote(util.localpath(s)))
-        cmd = toolpath + ' ' + args
-        repo.ui.debug('launching merge tool: %s\n' % cmd)
-        r = ui.system(cmd, cwd=repo.root, environ=env)
-        repo.ui.debug('merge tool returned: %s\n' % r)
-        return True, r
-    return False, 0
+    args = _toolstr(ui, tool, "args", '$local $base $other')
+    if "$output" in args:
+        out, a = a, back # read input from backup, write to original
+    replace = {'local': a, 'base': b, 'other': c, 'output': out}
+    args = util.interpolate(r'\$', replace, args,
+                            lambda s: util.shellquote(util.localpath(s)))
+    cmd = toolpath + ' ' + args
+    repo.ui.debug('launching merge tool: %s\n' % cmd)
+    r = ui.system(cmd, cwd=repo.root, environ=env)
+    repo.ui.debug('merge tool returned: %s\n' % r)
+    return True, r
 
 def _formatconflictmarker(repo, ctx, template, label, pad):
     """Applies the given template to the ctx, prefixed by the label.


More information about the Mercurial-devel mailing list