merge: move merge step to the end
authorSiddharth Agarwal <sid0@fb.com>
Wed, 16 Sep 2015 12:36:21 -0700
changeset 26292 007ac1acfcac
parent 26291 1d33842c5b3e
child 26293 3d24f31c6b8f
merge: move merge step to the end Resolving other conflicts before merge ones is better because the state before the merge is as consistent as possible. It will also help with future work involving automatic resolution of merge conflicts with an external merge driver. There are no ordering issues here because it is easy to verify that the same file is never in both the dg/dm and the m sets.
mercurial/merge.py
--- a/mercurial/merge.py	Wed Sep 16 19:52:06 2015 -0700
+++ b/mercurial/merge.py	Wed Sep 16 12:36:21 2015 -0700
@@ -795,25 +795,6 @@
         repo.ui.debug(" %s: %s -> k\n" % (f, msg))
         # no progress
 
-    # merge
-    for f, args, msg in actions['m']:
-        repo.ui.debug(" %s: %s -> m\n" % (f, msg))
-        z += 1
-        progress(_updating, z, item=f, total=numupdates, unit=_files)
-        if f == '.hgsubstate': # subrepo states need updating
-            subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx),
-                             overwrite)
-            continue
-        audit(f)
-        r = ms.resolve(f, wctx, labels=labels)
-        if r is not None and r > 0:
-            unresolved += 1
-        else:
-            if r is None:
-                updated += 1
-            else:
-                merged += 1
-
     # directory rename, move local
     for f, args, msg in actions['dm']:
         repo.ui.debug(" %s: %s -> dm\n" % (f, msg))
@@ -846,6 +827,25 @@
         util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags)
         updated += 1
 
+    # merge
+    for f, args, msg in actions['m']:
+        repo.ui.debug(" %s: %s -> m\n" % (f, msg))
+        z += 1
+        progress(_updating, z, item=f, total=numupdates, unit=_files)
+        if f == '.hgsubstate': # subrepo states need updating
+            subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx),
+                             overwrite)
+            continue
+        audit(f)
+        r = ms.resolve(f, wctx, labels=labels)
+        if r is not None and r > 0:
+            unresolved += 1
+        else:
+            if r is None:
+                updated += 1
+            else:
+                merged += 1
+
     ms.commit()
     progress(_updating, None, total=numupdates, unit=_files)