Patchwork [6,of,6,mergedriver] merge.mergestate: perform all premerges before any merges (BC)

login
register
mail settings
Submitter Siddharth Agarwal
Date Oct. 12, 2015, 8:09 p.m.
Message ID <1c951a14e4277041b05e.1444680582@dev6666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/10975/
State Accepted
Headers show

Comments

Siddharth Agarwal - Oct. 12, 2015, 8:09 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1444625799 25200
#      Sun Oct 11 21:56:39 2015 -0700
# Node ID 1c951a14e4277041b05e0851f2858f3faa1ec7c9
# Parent  d16d6cbc3155462397dd78398f488307a4bc1545
merge.mergestate: perform all premerges before any merges (BC)

The test output changes indicate the actual behavior change happening.
Pierre-Yves David - Oct. 13, 2015, 2:36 a.m.
On 10/12/2015 01:09 PM, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1444625799 25200
> #      Sun Oct 11 21:56:39 2015 -0700
> # Node ID 1c951a14e4277041b05e0851f2858f3faa1ec7c9
> # Parent  d16d6cbc3155462397dd78398f488307a4bc1545
> merge.mergestate: perform all premerges before any merges (BC)

I've reviewed these one and they are pushed to the clowncopter.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -850,9 +850,10 @@  def applyupdates(repo, actions, wctx, mc
         util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags)
         updated += 1
 
-    # merge
+    # premerge
+    tocomplete = []
     for f, args, msg in actions['m']:
-        repo.ui.debug(" %s: %s -> m\n" % (f, msg))
+        repo.ui.debug(" %s: %s -> m (premerge)\n" % (f, msg))
         z += 1
         progress(_updating, z, item=f, total=numupdates, unit=_files)
         if f == '.hgsubstate': # subrepo states need updating
@@ -861,8 +862,24 @@  def applyupdates(repo, actions, wctx, mc
             continue
         audit(f)
         complete, r = ms.preresolve(f, wctx, labels=labels)
-        if not complete:
-            r = ms.resolve(f, wctx, labels=labels)
+        if complete:
+            if r is not None and r > 0:
+                unresolved += 1
+            else:
+                if r is None:
+                    updated += 1
+                else:
+                    merged += 1
+        else:
+            numupdates += 1
+            tocomplete.append((f, args, msg))
+
+    # merge
+    for f, args, msg in tocomplete:
+        repo.ui.debug(" %s: %s -> m (merge)\n" % (f, msg))
+        z += 1
+        progress(_updating, z, item=f, total=numupdates, unit=_files)
+        r = ms.resolve(f, wctx, labels=labels)
         if r is not None and r > 0:
             unresolved += 1
         else:
diff --git a/tests/test-copy-move-merge.t b/tests/test-copy-move-merge.t
--- a/tests/test-copy-move-merge.t
+++ b/tests/test-copy-move-merge.t
@@ -34,12 +34,12 @@ 
    preserving a for resolve of b
    preserving a for resolve of c
   removing a
-   b: remote moved from a -> m
+   b: remote moved from a -> m (premerge)
   picked tool ':merge' for b (binary False symlink False)
   merging a and b to b
   my b@add3f11052fa+ other b@17c05bb7fcb6 ancestor a@b8bf91eeebbc
    premerge successful
-   c: remote moved from a -> m
+   c: remote moved from a -> m (premerge)
   picked tool ':merge' for c (binary False symlink False)
   merging a and c to c
   my c@add3f11052fa+ other c@17c05bb7fcb6 ancestor a@b8bf91eeebbc
diff --git a/tests/test-double-merge.t b/tests/test-double-merge.t
--- a/tests/test-double-merge.t
+++ b/tests/test-double-merge.t
@@ -37,12 +37,12 @@  we get conflicts that shouldn't be there
    ancestor: e6dc8efe11cc, local: 6a0df1dad128+, remote: 484bf6903104
    preserving foo for resolve of bar
    preserving foo for resolve of foo
-   bar: remote copied from foo -> m
+   bar: remote copied from foo -> m (premerge)
   picked tool ':merge' for bar (binary False symlink False)
   merging foo and bar to bar
   my bar@6a0df1dad128+ other bar@484bf6903104 ancestor foo@e6dc8efe11cc
    premerge successful
-   foo: versions differ -> m
+   foo: versions differ -> m (premerge)
   picked tool ':merge' for foo (binary False symlink False)
   merging foo
   my foo@6a0df1dad128+ other foo@484bf6903104 ancestor foo@e6dc8efe11cc
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -153,7 +153,7 @@  Graft out of order, skipping a merge and
    branchmerge: True, force: True, partial: False
    ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6
    preserving b for resolve of b
-   b: local copied/moved from a -> m
+   b: local copied/moved from a -> m (premerge)
   picked tool ':merge' for b (binary False symlink False)
   merging b and a to b
   my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622
@@ -183,10 +183,11 @@  Graft out of order, skipping a merge and
    d: remote is newer -> g
   getting d
    b: remote unchanged -> k
-   e: versions differ -> m
+   e: versions differ -> m (premerge)
   picked tool ':merge' for e (binary False symlink False)
   merging e
   my e@1905859650ec+ other e@9c233e8e184d ancestor e@68795b066622
+   e: versions differ -> m (merge)
   picked tool ':merge' for e (binary False symlink False)
   my e@1905859650ec+ other e@9c233e8e184d ancestor e@68795b066622
   warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
diff --git a/tests/test-issue672.t b/tests/test-issue672.t
--- a/tests/test-issue672.t
+++ b/tests/test-issue672.t
@@ -65,7 +65,7 @@  https://bz.mercurial-scm.org/672
    branchmerge: True, force: False, partial: False
    ancestor: c64f439569a9, local: e327dca35ac8+, remote: 746e9549ea96
    preserving 1a for resolve of 1a
-   1a: local copied/moved from 1 -> m
+   1a: local copied/moved from 1 -> m (premerge)
   picked tool ':merge' for 1a (binary False symlink False)
   merging 1a and 1 to 1a
   my 1a@e327dca35ac8+ other 1@746e9549ea96 ancestor 1@81f4b099af3d
@@ -88,7 +88,7 @@  https://bz.mercurial-scm.org/672
    ancestor: c64f439569a9, local: 746e9549ea96+, remote: e327dca35ac8
    preserving 1 for resolve of 1a
   removing 1
-   1a: remote moved from 1 -> m
+   1a: remote moved from 1 -> m (premerge)
   picked tool ':merge' for 1a (binary False symlink False)
   merging 1 and 1a to 1a
   my 1a@746e9549ea96+ other 1a@e327dca35ac8 ancestor 1@81f4b099af3d
diff --git a/tests/test-lfconvert.t b/tests/test-lfconvert.t
--- a/tests/test-lfconvert.t
+++ b/tests/test-lfconvert.t
@@ -124,9 +124,9 @@  add some changesets to rename/remove/mer
   $ hg commit -q -m"remove large, normal3"
   $ hg merge
   merging sub/maybelarge.dat and stuff/maybelarge.dat to stuff/maybelarge.dat
+  merging sub/normal2 and stuff/normal2 to stuff/normal2
   warning: $TESTTMP/bigfile-repo/stuff/maybelarge.dat looks like a binary file. (glob)
   warning: conflicts while merging stuff/maybelarge.dat! (edit, then use 'hg resolve --mark')
-  merging sub/normal2 and stuff/normal2 to stuff/normal2
   0 files updated, 1 files merged, 0 files removed, 1 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   [1]
diff --git a/tests/test-merge-commit.t b/tests/test-merge-commit.t
--- a/tests/test-merge-commit.t
+++ b/tests/test-merge-commit.t
@@ -72,7 +72,7 @@  This should use bar@rev2 as the ancestor
    branchmerge: True, force: False, partial: False
    ancestor: 0f2ff26688b9, local: 2263c1be0967+, remote: 0555950ead28
    preserving bar for resolve of bar
-   bar: versions differ -> m
+   bar: versions differ -> m (premerge)
   picked tool ':merge' for bar (binary False symlink False)
   merging bar
   my bar@2263c1be0967+ other bar@0555950ead28 ancestor bar@0f2ff26688b9
@@ -158,7 +158,7 @@  This should use bar@rev2 as the ancestor
    branchmerge: True, force: False, partial: False
    ancestor: 0f2ff26688b9, local: 2263c1be0967+, remote: 3ffa6b9e35f0
    preserving bar for resolve of bar
-   bar: versions differ -> m
+   bar: versions differ -> m (premerge)
   picked tool ':merge' for bar (binary False symlink False)
   merging bar
   my bar@2263c1be0967+ other bar@3ffa6b9e35f0 ancestor bar@0f2ff26688b9
diff --git a/tests/test-merge-criss-cross.t b/tests/test-merge-criss-cross.t
--- a/tests/test-merge-criss-cross.t
+++ b/tests/test-merge-criss-cross.t
@@ -82,10 +82,11 @@  Criss cross merging
    preserving f2 for resolve of f2
    f1: remote is newer -> g
   getting f1
-   f2: versions differ -> m
+   f2: versions differ -> m (premerge)
   picked tool ':dump' for f2 (binary False symlink False)
   merging f2
   my f2@3b08d01b0ab5+ other f2@adfe50279922 ancestor f2@40494bf2444c
+   f2: versions differ -> m (merge)
   picked tool ':dump' for f2 (binary False symlink False)
   my f2@3b08d01b0ab5+ other f2@adfe50279922 ancestor f2@40494bf2444c
   1 files updated, 0 files merged, 0 files removed, 1 files unresolved
diff --git a/tests/test-merge-force.t b/tests/test-merge-force.t
--- a/tests/test-merge-force.t
+++ b/tests/test-merge-force.t
@@ -192,27 +192,27 @@  Merge with remote
   remote changed content1_content2_missing_missing-untracked which local deleted
   use (c)hanged version or leave (d)eleted? c
   merging content1_content2_content1_content4-tracked
-  warning: conflicts while merging content1_content2_content1_content4-tracked! (edit, then use 'hg resolve --mark')
   merging content1_content2_content2_content1-tracked
   merging content1_content2_content2_content4-tracked
-  warning: conflicts while merging content1_content2_content2_content4-tracked! (edit, then use 'hg resolve --mark')
   merging content1_content2_content3_content1-tracked
   merging content1_content2_content3_content3-tracked
-  warning: conflicts while merging content1_content2_content3_content3-tracked! (edit, then use 'hg resolve --mark')
   merging content1_content2_content3_content4-tracked
-  warning: conflicts while merging content1_content2_content3_content4-tracked! (edit, then use 'hg resolve --mark')
   merging content1_content2_missing_content1-tracked
   merging content1_content2_missing_content4-tracked
+  merging missing_content2_content2_content4-tracked
+  merging missing_content2_content3_content3-tracked
+  merging missing_content2_content3_content4-tracked
+  merging missing_content2_missing_content4-tracked
+  merging missing_content2_missing_content4-untracked
+  warning: conflicts while merging content1_content2_content1_content4-tracked! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging content1_content2_content2_content4-tracked! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging content1_content2_content3_content3-tracked! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging content1_content2_content3_content4-tracked! (edit, then use 'hg resolve --mark')
   warning: conflicts while merging content1_content2_missing_content4-tracked! (edit, then use 'hg resolve --mark')
-  merging missing_content2_content2_content4-tracked
   warning: conflicts while merging missing_content2_content2_content4-tracked! (edit, then use 'hg resolve --mark')
-  merging missing_content2_content3_content3-tracked
   warning: conflicts while merging missing_content2_content3_content3-tracked! (edit, then use 'hg resolve --mark')
-  merging missing_content2_content3_content4-tracked
   warning: conflicts while merging missing_content2_content3_content4-tracked! (edit, then use 'hg resolve --mark')
-  merging missing_content2_missing_content4-tracked
   warning: conflicts while merging missing_content2_missing_content4-tracked! (edit, then use 'hg resolve --mark')
-  merging missing_content2_missing_content4-untracked
   warning: conflicts while merging missing_content2_missing_content4-untracked! (edit, then use 'hg resolve --mark')
   39 files updated, 3 files merged, 8 files removed, 10 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
diff --git a/tests/test-merge-types.t b/tests/test-merge-types.t
--- a/tests/test-merge-types.t
+++ b/tests/test-merge-types.t
@@ -35,7 +35,7 @@  Symlink is local parent, executable is o
    branchmerge: True, force: False, partial: False
    ancestor: c334dc3be0da, local: 521a1e40188f+, remote: 3574f3e69b1c
    preserving a for resolve of a
-   a: versions differ -> m
+   a: versions differ -> m (premerge)
   picked tool ':merge' for a (binary False symlink True)
   merging a
   my a@521a1e40188f+ other a@3574f3e69b1c ancestor a@c334dc3be0da
@@ -68,7 +68,7 @@  Symlink is other parent, executable is l
    branchmerge: True, force: False, partial: False
    ancestor: c334dc3be0da, local: 3574f3e69b1c+, remote: 521a1e40188f
    preserving a for resolve of a
-   a: versions differ -> m
+   a: versions differ -> m (premerge)
   picked tool ':union' for a (binary False symlink True)
   merging a
   my a@3574f3e69b1c+ other a@521a1e40188f ancestor a@c334dc3be0da
@@ -91,7 +91,7 @@  Symlink is other parent, executable is l
    branchmerge: True, force: False, partial: False
    ancestor: c334dc3be0da, local: 3574f3e69b1c+, remote: 521a1e40188f
    preserving a for resolve of a
-   a: versions differ -> m
+   a: versions differ -> m (premerge)
   picked tool ':merge3' for a (binary False symlink True)
   merging a
   my a@3574f3e69b1c+ other a@521a1e40188f ancestor a@c334dc3be0da
@@ -124,7 +124,7 @@  Update to link with local change should 
    branchmerge: False, force: False, partial: False
    ancestor: c334dc3be0da, local: c334dc3be0da+, remote: 521a1e40188f
    preserving a for resolve of a
-   a: versions differ -> m
+   a: versions differ -> m (premerge)
   (couldn't find merge tool hgmerge|tool hgmerge can't handle symlinks) (re)
   picked tool ':prompt' for a (binary False symlink True)
    no tool found to merge a
@@ -283,10 +283,8 @@  h: l vs l, different
 
   $ hg merge
   merging a
-  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
   warning: cannot merge flags for b
   merging b
-  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
   warning: cannot merge flags for c
   merging d
   warning: internal :merge cannot merge symlinks for d
@@ -297,6 +295,8 @@  h: l vs l, different
   merging h
   warning: internal :merge cannot merge symlinks for h
   warning: conflicts while merging h! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
   3 files updated, 0 files merged, 0 files removed, 5 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   [1]
@@ -342,10 +342,8 @@  h: l vs l, different
   $ hg up -Cqr1
   $ hg merge
   merging a
-  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
   warning: cannot merge flags for b
   merging b
-  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
   warning: cannot merge flags for c
   merging d
   warning: internal :merge cannot merge symlinks for d
@@ -356,6 +354,8 @@  h: l vs l, different
   merging h
   warning: internal :merge cannot merge symlinks for h
   warning: conflicts while merging h! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
   3 files updated, 0 files merged, 0 files removed, 5 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   [1]
diff --git a/tests/test-merge7.t b/tests/test-merge7.t
--- a/tests/test-merge7.t
+++ b/tests/test-merge7.t
@@ -84,10 +84,11 @@  pull and merge from test-a again
    branchmerge: True, force: False, partial: False
    ancestor: 96b70246a118, local: 50c3a7e29886+, remote: 40d11a4173a8
    preserving test.txt for resolve of test.txt
-   test.txt: versions differ -> m
+   test.txt: versions differ -> m (premerge)
   picked tool ':merge' for test.txt (binary False symlink False)
   merging test.txt
   my test.txt@50c3a7e29886+ other test.txt@40d11a4173a8 ancestor test.txt@96b70246a118
+   test.txt: versions differ -> m (merge)
   picked tool ':merge' for test.txt (binary False symlink False)
   my test.txt@50c3a7e29886+ other test.txt@40d11a4173a8 ancestor test.txt@96b70246a118
   warning: conflicts while merging test.txt! (edit, then use 'hg resolve --mark')
diff --git a/tests/test-merge9.t b/tests/test-merge9.t
--- a/tests/test-merge9.t
+++ b/tests/test-merge9.t
@@ -27,8 +27,8 @@  a file-level merge failed
 test with the rename on the remote side
   $ HGMERGE=false hg merge
   merging bar
+  merging foo and baz to baz
   merging bar failed!
-  merging foo and baz to baz
   1 files updated, 1 files merged, 0 files removed, 1 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   [1]
@@ -41,8 +41,8 @@  test with the rename on the local side
   3 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ HGMERGE=false hg merge
   merging bar
+  merging baz and foo to baz
   merging bar failed!
-  merging baz and foo to baz
   1 files updated, 1 files merged, 0 files removed, 1 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   [1]
diff --git a/tests/test-rename-merge1.t b/tests/test-rename-merge1.t
--- a/tests/test-rename-merge1.t
+++ b/tests/test-rename-merge1.t
@@ -40,7 +40,7 @@ 
   removing a
    b2: remote created -> g
   getting b2
-   b: remote moved from a -> m
+   b: remote moved from a -> m (premerge)
   picked tool ':merge' for b (binary False symlink False)
   merging a and b to b
   my b@044f8520aeeb+ other b@85c198ef2f6c ancestor a@af1939970a1c
diff --git a/tests/test-rename-merge2.t b/tests/test-rename-merge2.t
--- a/tests/test-rename-merge2.t
+++ b/tests/test-rename-merge2.t
@@ -89,15 +89,16 @@  args:
    preserving a for resolve of b
    preserving rev for resolve of rev
    a: remote unchanged -> k
-   b: remote copied from a -> m
+   b: remote copied from a -> m (premerge)
   picked tool 'python ../merge' for b (binary False symlink False)
   merging a and b to b
   my b@e300d1c794ec+ other b@4ce40f5aca24 ancestor a@924404dff337
    premerge successful
-   rev: versions differ -> m
+   rev: versions differ -> m (premerge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@e300d1c794ec+ other rev@4ce40f5aca24 ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@e300d1c794ec+ other rev@4ce40f5aca24 ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -128,15 +129,16 @@  args:
    preserving rev for resolve of rev
    a: remote is newer -> g
   getting a
-   b: local copied/moved from a -> m
+   b: local copied/moved from a -> m (premerge)
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b and a to b
   my b@86a2aa42fc76+ other a@f4db7e329e71 ancestor a@924404dff337
    premerge successful
-   rev: versions differ -> m
+   rev: versions differ -> m (premerge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@86a2aa42fc76+ other rev@f4db7e329e71 ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@86a2aa42fc76+ other rev@f4db7e329e71 ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -166,15 +168,16 @@  args:
    preserving a for resolve of b
    preserving rev for resolve of rev
   removing a
-   b: remote moved from a -> m
+   b: remote moved from a -> m (premerge)
   picked tool 'python ../merge' for b (binary False symlink False)
   merging a and b to b
   my b@e300d1c794ec+ other b@bdb19105162a ancestor a@924404dff337
    premerge successful
-   rev: versions differ -> m
+   rev: versions differ -> m (premerge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@e300d1c794ec+ other rev@bdb19105162a ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@e300d1c794ec+ other rev@bdb19105162a ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -202,15 +205,16 @@  args:
    ancestor: 924404dff337, local: 02963e448370+, remote: f4db7e329e71
    preserving b for resolve of b
    preserving rev for resolve of rev
-   b: local copied/moved from a -> m
+   b: local copied/moved from a -> m (premerge)
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b and a to b
   my b@02963e448370+ other a@f4db7e329e71 ancestor a@924404dff337
    premerge successful
-   rev: versions differ -> m
+   rev: versions differ -> m (premerge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@02963e448370+ other rev@f4db7e329e71 ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@02963e448370+ other rev@f4db7e329e71 ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -239,10 +243,11 @@  args:
    preserving rev for resolve of rev
    b: remote created -> g
   getting b
-   rev: versions differ -> m
+   rev: versions differ -> m (premerge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@94b33a1b7f2d+ other rev@4ce40f5aca24 ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@94b33a1b7f2d+ other rev@4ce40f5aca24 ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -269,10 +274,11 @@  args:
    branchmerge: True, force: False, partial: False
    ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 97c705ade336
    preserving rev for resolve of rev
-   rev: versions differ -> m
+   rev: versions differ -> m (premerge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@86a2aa42fc76+ other rev@97c705ade336 ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@86a2aa42fc76+ other rev@97c705ade336 ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -303,10 +309,11 @@  args:
   removing a
    b: remote created -> g
   getting b
-   rev: versions differ -> m
+   rev: versions differ -> m (premerge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@94b33a1b7f2d+ other rev@bdb19105162a ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@94b33a1b7f2d+ other rev@bdb19105162a ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -332,10 +339,11 @@  args:
    branchmerge: True, force: False, partial: False
    ancestor: 924404dff337, local: 02963e448370+, remote: 97c705ade336
    preserving rev for resolve of rev
-   rev: versions differ -> m
+   rev: versions differ -> m (premerge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@02963e448370+ other rev@97c705ade336 ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@02963e448370+ other rev@97c705ade336 ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -359,18 +367,20 @@  args:
    ancestor: 924404dff337, local: 62e7bf090eba+, remote: 49b6d8032493
    preserving b for resolve of b
    preserving rev for resolve of rev
-   b: both renamed from a -> m
+   b: both renamed from a -> m (premerge)
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@62e7bf090eba+ other b@49b6d8032493 ancestor a@924404dff337
+   rev: versions differ -> m (premerge)
+  picked tool 'python ../merge' for rev (binary False symlink False)
+  merging rev
+  my rev@62e7bf090eba+ other rev@49b6d8032493 ancestor rev@924404dff337
+   b: both renamed from a -> m (merge)
   picked tool 'python ../merge' for b (binary False symlink False)
   my b@62e7bf090eba+ other b@49b6d8032493 ancestor a@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
-   rev: versions differ -> m
-  picked tool 'python ../merge' for rev (binary False symlink False)
-  merging rev
-  my rev@62e7bf090eba+ other rev@49b6d8032493 ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@62e7bf090eba+ other rev@49b6d8032493 ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -404,10 +414,11 @@  m "um a c" "um x c" "      " "10 do merg
    preserving rev for resolve of rev
    c: remote created -> g
   getting c
-   rev: versions differ -> m
+   rev: versions differ -> m (premerge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@02963e448370+ other rev@fe905ef2c33e ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@02963e448370+ other rev@fe905ef2c33e ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -435,18 +446,20 @@  m "um a c" "um x c" "      " "10 do merg
    ancestor: 924404dff337, local: 86a2aa42fc76+, remote: af30c7647fc7
    preserving b for resolve of b
    preserving rev for resolve of rev
-   b: both created -> m
+   b: both created -> m (premerge)
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@86a2aa42fc76+ other b@af30c7647fc7 ancestor b@000000000000
+   rev: versions differ -> m (premerge)
+  picked tool 'python ../merge' for rev (binary False symlink False)
+  merging rev
+  my rev@86a2aa42fc76+ other rev@af30c7647fc7 ancestor rev@924404dff337
+   b: both created -> m (merge)
   picked tool 'python ../merge' for b (binary False symlink False)
   my b@86a2aa42fc76+ other b@af30c7647fc7 ancestor b@000000000000
   launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
-   rev: versions differ -> m
-  picked tool 'python ../merge' for rev (binary False symlink False)
-  merging rev
-  my rev@86a2aa42fc76+ other rev@af30c7647fc7 ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@86a2aa42fc76+ other rev@af30c7647fc7 ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -473,18 +486,20 @@  m "um a c" "um x c" "      " "10 do merg
    preserving rev for resolve of rev
    a: other deleted -> r
   removing a
-   b: both created -> m
+   b: both created -> m (premerge)
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
+   rev: versions differ -> m (premerge)
+  picked tool 'python ../merge' for rev (binary False symlink False)
+  merging rev
+  my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
+   b: both created -> m (merge)
   picked tool 'python ../merge' for b (binary False symlink False)
   my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
   launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
-   rev: versions differ -> m
-  picked tool 'python ../merge' for rev (binary False symlink False)
-  merging rev
-  my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -510,18 +525,20 @@  m "um a c" "um x c" "      " "10 do merg
    preserving rev for resolve of rev
    a: remote is newer -> g
   getting a
-   b: both created -> m
+   b: both created -> m (premerge)
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
+   rev: versions differ -> m (premerge)
+  picked tool 'python ../merge' for rev (binary False symlink False)
+  merging rev
+  my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
+   b: both created -> m (merge)
   picked tool 'python ../merge' for b (binary False symlink False)
   my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
   launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
-   rev: versions differ -> m
-  picked tool 'python ../merge' for rev (binary False symlink False)
-  merging rev
-  my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -548,18 +565,20 @@  m "um a c" "um x c" "      " "10 do merg
    preserving rev for resolve of rev
    a: other deleted -> r
   removing a
-   b: both created -> m
+   b: both created -> m (premerge)
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
+   rev: versions differ -> m (premerge)
+  picked tool 'python ../merge' for rev (binary False symlink False)
+  merging rev
+  my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
+   b: both created -> m (merge)
   picked tool 'python ../merge' for b (binary False symlink False)
   my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
   launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
-   rev: versions differ -> m
-  picked tool 'python ../merge' for rev (binary False symlink False)
-  merging rev
-  my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -585,18 +604,20 @@  m "um a c" "um x c" "      " "10 do merg
    preserving rev for resolve of rev
    a: remote is newer -> g
   getting a
-   b: both created -> m
+   b: both created -> m (premerge)
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
+   rev: versions differ -> m (premerge)
+  picked tool 'python ../merge' for rev (binary False symlink False)
+  merging rev
+  my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
+   b: both created -> m (merge)
   picked tool 'python ../merge' for b (binary False symlink False)
   my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
   launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
-   rev: versions differ -> m
-  picked tool 'python ../merge' for rev (binary False symlink False)
-  merging rev
-  my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -622,18 +643,20 @@  m "um a c" "um x c" "      " "10 do merg
    preserving b for resolve of b
    preserving rev for resolve of rev
    a: remote unchanged -> k
-   b: both created -> m
+   b: both created -> m (premerge)
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000
+   rev: versions differ -> m (premerge)
+  picked tool 'python ../merge' for rev (binary False symlink False)
+  merging rev
+  my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337
+   b: both created -> m (merge)
   picked tool 'python ../merge' for b (binary False symlink False)
   my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000
   launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
-   rev: versions differ -> m
-  picked tool 'python ../merge' for rev (binary False symlink False)
-  merging rev
-  my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -662,18 +685,20 @@  m "um a c" "um x c" "      " "10 do merg
    preserving rev for resolve of rev
    a: prompt recreating -> g
   getting a
-   b: both created -> m
+   b: both created -> m (premerge)
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000
+   rev: versions differ -> m (premerge)
+  picked tool 'python ../merge' for rev (binary False symlink False)
+  merging rev
+  my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337
+   b: both created -> m (merge)
   picked tool 'python ../merge' for b (binary False symlink False)
   my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000
   launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
-   rev: versions differ -> m
-  picked tool 'python ../merge' for rev (binary False symlink False)
-  merging rev
-  my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -701,18 +726,20 @@  m "um a c" "um x c" "      " "10 do merg
    preserving b for resolve of b
    preserving rev for resolve of rev
    a: prompt keep -> a
-   b: both created -> m
+   b: both created -> m (premerge)
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b
   my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000
+   rev: versions differ -> m (premerge)
+  picked tool 'python ../merge' for rev (binary False symlink False)
+  merging rev
+  my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337
+   b: both created -> m (merge)
   picked tool 'python ../merge' for b (binary False symlink False)
   my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000
   launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
-   rev: versions differ -> m
-  picked tool 'python ../merge' for rev (binary False symlink False)
-  merging rev
-  my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -741,18 +768,20 @@  m "um a c" "um x c" "      " "10 do merg
    preserving a for resolve of b
    preserving rev for resolve of rev
   removing a
-   b: remote moved from a -> m
+   b: remote moved from a -> m (premerge)
   picked tool 'python ../merge' for b (binary False symlink False)
   merging a and b to b
   my b@e300d1c794ec+ other b@49b6d8032493 ancestor a@924404dff337
+   rev: versions differ -> m (premerge)
+  picked tool 'python ../merge' for rev (binary False symlink False)
+  merging rev
+  my rev@e300d1c794ec+ other rev@49b6d8032493 ancestor rev@924404dff337
+   b: remote moved from a -> m (merge)
   picked tool 'python ../merge' for b (binary False symlink False)
   my b@e300d1c794ec+ other b@49b6d8032493 ancestor a@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
-   rev: versions differ -> m
-  picked tool 'python ../merge' for rev (binary False symlink False)
-  merging rev
-  my rev@e300d1c794ec+ other rev@49b6d8032493 ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@e300d1c794ec+ other rev@49b6d8032493 ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -780,18 +809,20 @@  m "um a c" "um x c" "      " "10 do merg
    ancestor: 924404dff337, local: 62e7bf090eba+, remote: f4db7e329e71
    preserving b for resolve of b
    preserving rev for resolve of rev
-   b: local copied/moved from a -> m
+   b: local copied/moved from a -> m (premerge)
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b and a to b
   my b@62e7bf090eba+ other a@f4db7e329e71 ancestor a@924404dff337
+   rev: versions differ -> m (premerge)
+  picked tool 'python ../merge' for rev (binary False symlink False)
+  merging rev
+  my rev@62e7bf090eba+ other rev@f4db7e329e71 ancestor rev@924404dff337
+   b: local copied/moved from a -> m (merge)
   picked tool 'python ../merge' for b (binary False symlink False)
   my b@62e7bf090eba+ other a@f4db7e329e71 ancestor a@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/b* * * (glob)
   merge tool returned: 0
-   rev: versions differ -> m
-  picked tool 'python ../merge' for rev (binary False symlink False)
-  merging rev
-  my rev@62e7bf090eba+ other rev@f4db7e329e71 ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@62e7bf090eba+ other rev@f4db7e329e71 ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
@@ -826,15 +857,16 @@  m "nm a b" "um x a" "      " "22 get a, 
    preserving rev for resolve of rev
    c: remote created -> g
   getting c
-   b: local copied/moved from a -> m
+   b: local copied/moved from a -> m (premerge)
   picked tool 'python ../merge' for b (binary False symlink False)
   merging b and a to b
   my b@02963e448370+ other a@2b958612230f ancestor a@924404dff337
    premerge successful
-   rev: versions differ -> m
+   rev: versions differ -> m (premerge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   merging rev
   my rev@02963e448370+ other rev@2b958612230f ancestor rev@924404dff337
+   rev: versions differ -> m (merge)
   picked tool 'python ../merge' for rev (binary False symlink False)
   my rev@02963e448370+ other rev@2b958612230f ancestor rev@924404dff337
   launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
diff --git a/tests/test-status-color.t b/tests/test-status-color.t
--- a/tests/test-status-color.t
+++ b/tests/test-status-color.t
@@ -325,8 +325,8 @@  test 'resolve -l'
   created new head
   $ hg merge
   merging a
+  merging b
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
-  merging b
   warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
   0 files updated, 0 files merged, 0 files removed, 2 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -259,7 +259,7 @@  merge tests
   resolving manifests
    branchmerge: True, force: False, partial: False
    ancestor: 1f14a2e2d3ec, local: f0d2028bf86d+, remote: 1831e14459c4
-   .hgsubstate: versions differ -> m
+   .hgsubstate: versions differ -> m (premerge)
   subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
     subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
   getting subrepo t
@@ -285,7 +285,7 @@  merge tests
   resolving manifests
    branchmerge: True, force: False, partial: False
    ancestor: 1831e14459c4, local: e45c8b14af55+, remote: f94576341bcf
-   .hgsubstate: versions differ -> m
+   .hgsubstate: versions differ -> m (premerge)
   subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
     subrepo t: both sides changed 
    subrepository t diverged (local revision: 20a0db6fbf6c, remote revision: 7af322bc1198)
@@ -296,10 +296,11 @@  merge tests
    branchmerge: True, force: False, partial: False
    ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198
    preserving t for resolve of t
-   t: versions differ -> m
+   t: versions differ -> m (premerge)
   picked tool ':merge' for t (binary False symlink False)
   merging t
   my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
+   t: versions differ -> m (merge)
   picked tool ':merge' for t (binary False symlink False)
   my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
   warning: conflicts while merging t! (edit, then use 'hg resolve --mark')
diff --git a/tests/test-up-local-change.t b/tests/test-up-local-change.t
--- a/tests/test-up-local-change.t
+++ b/tests/test-up-local-change.t
@@ -49,10 +49,11 @@ 
    preserving a for resolve of a
    b: remote created -> g
   getting b
-   a: versions differ -> m
+   a: versions differ -> m (premerge)
   picked tool 'true' for a (binary False symlink False)
   merging a
   my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
+   a: versions differ -> m (merge)
   picked tool 'true' for a (binary False symlink False)
   my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
   launching merge tool: true *$TESTTMP/r2/a* * * (glob)
@@ -72,10 +73,11 @@ 
    preserving a for resolve of a
    b: other deleted -> r
   removing b
-   a: versions differ -> m
+   a: versions differ -> m (premerge)
   picked tool 'true' for a (binary False symlink False)
   merging a
   my a@1e71731e6fbb+ other a@c19d34741b0a ancestor a@1e71731e6fbb
+   a: versions differ -> m (merge)
   picked tool 'true' for a (binary False symlink False)
   my a@1e71731e6fbb+ other a@c19d34741b0a ancestor a@1e71731e6fbb
   launching merge tool: true *$TESTTMP/r2/a* * * (glob)
@@ -103,10 +105,11 @@ 
    preserving a for resolve of a
    b: remote created -> g
   getting b
-   a: versions differ -> m
+   a: versions differ -> m (premerge)
   picked tool 'true' for a (binary False symlink False)
   merging a
   my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
+   a: versions differ -> m (merge)
   picked tool 'true' for a (binary False symlink False)
   my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a
   launching merge tool: true *$TESTTMP/r2/a* * * (glob)