D7704: status: make morestatus call out unresolved conflicts after update

rdamazio (Rodrigo Damazio Bovendorp) phabricator at mercurial-scm.org
Thu Dec 19 12:56:57 EST 2019


Closed by commit rHG489fdf27769c: status: make morestatus call out unresolved conflicts after update (authored by rdamazio).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7704?vs=18876&id=18880

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7704/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7704

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-update-branches.t

CHANGE DETAILS

diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -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)
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -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(



To: rdamazio, #hg-reviewers, pulkit
Cc: mercurial-devel


More information about the Mercurial-devel mailing list