merge: refactor some initialization, drop backwards var
authorMatt Mackall <mpm@selenic.com>
Mon, 08 Jun 2009 18:14:44 -0500
changeset 8749 69caf50da4a0
parent 8748 f325574dad1a
child 8750 9b8733291dd0
merge: refactor some initialization, drop backwards var
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
@@ -129,19 +129,10 @@
     repo.ui.debug(_(" overwrite %s partial %s\n") % (overwrite, bool(partial)))
     repo.ui.debug(_(" ancestor %s local %s remote %s\n") % (pa, p1, p2))
 
+    action = []
+    copy, copied, diverge = {}, {}, {}
     m1 = p1.manifest()
     m2 = p2.manifest()
-    backwards = (pa == p2)
-
-    if overwrite:
-        ma = m1
-    elif backwards:
-        ma = p1.p1().manifest()
-    else:
-        ma = pa.manifest()
-
-    action = []
-    copy, copied, diverge = {}, {}, {}
 
     def fmerge(f, f2, fa):
         """merge flags"""
@@ -164,8 +155,13 @@
         repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m))
         action.append((f, m) + args)
 
-    if pa and not (backwards or overwrite):
-        if repo.ui.configbool("merge", "followcopies", True):
+    if overwrite:
+        ma = m1
+    elif p2 == pa: # backwards
+        ma = p1.p1().manifest()
+    else:
+        ma = pa.manifest()
+        if pa and repo.ui.configbool("merge", "followcopies", True):
             dirs = repo.ui.configbool("merge", "followdirs", True)
             copy, diverge = copies.copies(repo, p1, p2, pa, dirs)
         copied = set(copy.values())