merge: simplify flag merging code slightly
authorMatt Mackall <mpm@selenic.com>
Mon, 08 Jun 2009 18:14:44 -0500
changeset 8733 f8be48c6b08c
parent 8732 3507f6c7715c
child 8734 60fa3371aa75
merge: simplify flag merging code slightly
mercurial/merge.py
--- a/mercurial/merge.py	Mon Jun 08 18:14:44 2009 -0500
+++ b/mercurial/merge.py	Mon Jun 08 18:14:44 2009 -0500
@@ -136,24 +136,17 @@
     action = []
     copy, copied, diverge = {}, {}, {}
 
-    def fmerge(f, f2=None, fa=None):
+    def fmerge(f, f2, fa):
         """merge flags"""
-        if not f2:
-            f2 = f
-            fa = f
         a, m, n = ma.flags(fa), m1.flags(f), m2.flags(f2)
         if m == n: # flags agree
             return m # unchanged
-        if m and n: # flags are set but don't agree
-            if not a: # both differ from parent
-                r = repo.ui.prompt(
-                    _(" conflicting flags for %s\n"
-                      "(n)one, e(x)ec or sym(l)ink?") % f,
-                    (_("&None"), _("E&xec"), _("Sym&link")), _("n"))
-                return r != _("n") and r or ''
-            if m == a:
-                return n # changed from m to n
-            return m # changed from n to m
+        if m and n and not a: # flags set, don't agree, differ from parent
+            r = repo.ui.prompt(
+                _(" conflicting flags for %s\n"
+                  "(n)one, e(x)ec or sym(l)ink?") % f,
+                (_("&None"), _("E&xec"), _("Sym&link")), _("n"))
+            return r != _("n") and r or ''
         if m and m != a: # changed from a to m
             return m
         if n and n != a: # changed from a to n
@@ -180,7 +173,7 @@
             if overwrite or backwards:
                 rflags = m2.flags(f)
             else:
-                rflags = fmerge(f)
+                rflags = fmerge(f, f, f)
             # are files different?
             if n != m2[f]:
                 a = ma.get(f, nullid)