diff mercurial/cmdutil.py @ 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
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(