changeset 43938:489fdf27769c

status: make morestatus call out unresolved conflicts after update Differential Revision: https://phab.mercurial-scm.org/D7704
author Rodrigo Damazio Bovendorp <rdamazio@google.com>
date Wed, 18 Dec 2019 23:43:21 -0800
parents 4ca89cc20d02
children 07ebb567e8bb
files mercurial/cmdutil.py tests/test-update-branches.t
diffstat 2 files changed, 46 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Dec 18 23:41:36 2019 -0800
+++ b/mercurial/cmdutil.py	Wed Dec 18 23:43:21 2019 -0800
@@ -818,20 +818,22 @@
             fm.data(unresolved=True)
 
     def formatfooter(self, fm):
-        fm.startitem()
-        fm.data(
-            itemtype=b'morestatus',
-            unfinished=self.unfinishedop,
-            unfinishedmsg=self.unfinishedmsg,
-        )
-
-        statemsg = (
-            _(b'The repository is in an unfinished *%s* state.')
-            % self.unfinishedop
-        )
-        fm.plain(b'%s\n' % _commentlines(statemsg), label=self._label)
+        if self.unfinishedop or self.unfinishedmsg:
+            fm.startitem()
+            fm.data(itemtype=b'morestatus')
+
+        if self.unfinishedop:
+            fm.data(unfinished=self.unfinishedop)
+            statemsg = (
+                _(b'The repository is in an unfinished *%s* state.')
+                % self.unfinishedop
+            )
+            fm.plain(b'%s\n' % _commentlines(statemsg), label=self._label)
+        if self.unfinishedmsg:
+            fm.data(unfinishedmsg=self.unfinishedmsg)
 
         self._formatconflicts(fm)
+
         if self.unfinishedmsg:
             fm.plain(
                 b'%s\n' % _commentlines(self.unfinishedmsg), label=self._label
@@ -870,12 +872,12 @@
     statetuple = statemod.getrepostate(repo)
     mergestate = mergemod.mergestate.read(repo)
     activemerge = mergestate.active()
-    if not statetuple:
+    if not statetuple and not activemerge:
         return None
 
-    unfinishedop, unfinishedmsg = statetuple
-    mergestate = mergemod.mergestate.read(repo)
-    unresolved = None
+    unfinishedop = unfinishedmsg = unresolved = None
+    if statetuple:
+        unfinishedop, unfinishedmsg = statetuple
     if activemerge:
         unresolved = sorted(mergestate.unresolved())
     return morestatus(
--- a/tests/test-update-branches.t	Wed Dec 18 23:41:36 2019 -0800
+++ b/tests/test-update-branches.t	Wed Dec 18 23:43:21 2019 -0800
@@ -252,6 +252,12 @@
   $ hg st
   M a
   ? a.orig
+  # Unresolved merge conflicts:
+  # 
+  #     a
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
   $ cat a
   <<<<<<< working copy: 6efa171f091b - test: 3
   three
@@ -315,6 +321,12 @@
   $ rm a.orig
   $ hg status
   M a
+  # Unresolved merge conflicts:
+  # 
+  #     a
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
   $ hg resolve -l
   U a
 
@@ -553,6 +565,12 @@
   $ hg status
   M a
   M foo
+  # Unresolved merge conflicts:
+  # 
+  #     a
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
 
   $ hg revert -r . a
 
@@ -561,6 +579,12 @@
   U a
   $ hg status
   M foo
+  # Unresolved merge conflicts:
+  # 
+  #     a
+  # 
+  # To mark files as resolved:  hg resolve --mark FILE
+  
   $ hg status -Tjson
   [
    {
@@ -577,6 +601,8 @@
   R a
   $ hg status
   M foo
+  # No unresolved merge conflicts.
+  
   $ hg status -Tjson
   [
    {
@@ -589,6 +615,8 @@
 Test that 4 is detected as the no-argument destination from 3 and also moves
 the bookmark with it
   $ hg up --quiet 0          # we should be able to update to 3 directly
+  $ hg status
+  M foo
   $ hg up --quiet --hidden 3 # but not implemented yet.
   updated to hidden changeset 6efa171f091b
   (hidden revision '6efa171f091b' was rewritten as: d047485b3896)