Patchwork [2,of,5,v2] summary: move mergemod before parents to give access to ms

login
register
mail settings
Submitter timeless@mozdev.org
Date March 23, 2016, 3:23 a.m.
Message ID <a0537de695eedc01bd2e.1458703437@waste.org>
Download mbox | patch
Permalink /patch/14037/
State Accepted
Headers show

Comments

timeless@mozdev.org - March 23, 2016, 3:23 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1458226229 0
#      Thu Mar 17 14:50:29 2016 +0000
# Node ID a0537de695eedc01bd2e3dc847324b8d01b8c0ef
# Parent  994882c8bff031e25365a5ebf02451eba8c6d067
summary: move mergemod before parents to give access to ms
Pierre-Yves David - March 27, 2016, 7:46 p.m.
On 03/22/2016 08:23 PM, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1458226229 0
> #      Thu Mar 17 14:50:29 2016 +0000
> # Node ID a0537de695eedc01bd2e3dc847324b8d01b8c0ef
> # Parent  994882c8bff031e25365a5ebf02451eba8c6d067
> summary: move mergemod before parents to give access to ms

I've pushed patches 1-2, thanks.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6573,6 +6573,17 @@ 
     pnode = parents[0].node()
     marks = []
 
+    ms = None
+    try:
+        ms = mergemod.mergestate.read(repo)
+    except error.UnsupportedMergeRecords as e:
+        s = ' '.join(e.recordtypes)
+        ui.warn(
+            _('warning: merge state has unsupported record types: %s\n') % s)
+        unresolved = 0
+    else:
+        unresolved = [f for f in ms if ms[f] == 'u']
+
     for p in parents:
         # label with log.changeset (instead of log.parent) since this
         # shows a working directory parent *changeset*:
@@ -6628,16 +6639,6 @@ 
         if d in status.added:
             status.added.remove(d)
 
-    try:
-        ms = mergemod.mergestate.read(repo)
-    except error.UnsupportedMergeRecords as e:
-        s = ' '.join(e.recordtypes)
-        ui.warn(
-            _('warning: merge state has unsupported record types: %s\n') % s)
-        unresolved = 0
-    else:
-        unresolved = [f for f in ms if ms[f] == 'u']
-
     subs = [s for s in ctx.substate if ctx.sub(s).dirty()]
 
     labels = [(ui.label(_('%d modified'), 'status.modified'), status.modified),
diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -332,12 +332,12 @@ 
   (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
   [255]
   $ hg summary
+  warning: merge state has unsupported record types: X
   parent: 2:57653b9f834a 
    append baz to files
   parent: 1:dc77451844e3 
    append bar to files
   branch: default
-  warning: merge state has unsupported record types: X
   commit: 2 modified, 2 unknown (merge)
   update: 2 new changesets (update)
   phases: 5 draft