Patchwork [4,of,4] merge: move merge step to the end

login
register
mail settings
Submitter Siddharth Agarwal
Date Sept. 22, 2015, 4:33 a.m.
Message ID <b02b6815ea270a546263.1442896397@dev6666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/10568/
State Accepted
Headers show

Comments

Siddharth Agarwal - Sept. 22, 2015, 4:33 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1442432181 25200
#      Wed Sep 16 12:36:21 2015 -0700
# Node ID b02b6815ea270a546263452910e18cda125b093b
# Parent  8fecc2f74b6417f508eb4fc8e1358dad44bc396b
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.
Augie Fackler - Sept. 22, 2015, 7 p.m.
On Mon, Sep 21, 2015 at 09:33:17PM -0700, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1442432181 25200
> #      Wed Sep 16 12:36:21 2015 -0700
> # Node ID b02b6815ea270a546263452910e18cda125b093b
> # Parent  8fecc2f74b6417f508eb4fc8e1358dad44bc396b
> merge: move merge step to the end

queued these, thanks

>
> 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.
>
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -795,25 +795,6 @@ def applyupdates(repo, actions, wctx, mc
>          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 @@ def applyupdates(repo, actions, wctx, mc
>          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)
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -795,25 +795,6 @@  def applyupdates(repo, actions, wctx, mc
         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 @@  def applyupdates(repo, actions, wctx, mc
         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)