Patchwork D7668: status: make unresolved files always be in the morestatus structured output

login
register
mail settings
Submitter phabricator
Date Dec. 19, 2019, 5:56 p.m.
Message ID <03fd52ed26a21fe5dc0d7046a28f99a5@localhost.localdomain>
Download mbox | patch
Permalink /patch/43995/
State Not Applicable
Headers show

Comments

phabricator - Dec. 19, 2019, 5:56 p.m.
Closed by commit rHG07ebb567e8bb: status: make unresolved files always be in the morestatus structured output (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/D7668?vs=18877&id=18881

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

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

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

CHANGE DETAILS




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

Patch

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
@@ -591,6 +591,11 @@ 
     "itemtype": "file",
     "path": "foo",
     "status": "M"
+   },
+   {
+    "itemtype": "file",
+    "path": "a",
+    "unresolved": true
    }
   ]
 
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -811,9 +811,11 @@ 
     unfinishedmsg = attr.ib()
     activemerge = attr.ib()
     unresolvedpaths = attr.ib()
+    _formattedpaths = attr.ib(init=False, default=set())
     _label = b'status.morestatus'
 
     def formatfile(self, path, fm):
+        self._formattedpaths.add(path)
         if self.activemerge and path in self.unresolvedpaths:
             fm.data(unresolved=True)
 
@@ -832,6 +834,7 @@ 
         if self.unfinishedmsg:
             fm.data(unfinishedmsg=self.unfinishedmsg)
 
+        # May also start new data items.
         self._formatconflicts(fm)
 
         if self.unfinishedmsg:
@@ -861,6 +864,19 @@ 
                 )
                 % mergeliststr
             )
+
+            # If any paths with unresolved conflicts were not previously
+            # formatted, output them now.
+            for f in self.unresolvedpaths:
+                if f in self._formattedpaths:
+                    # Already output.
+                    continue
+                fm.startitem()
+                # We can't claim to know the status of the file - it may just
+                # have been in one of the states that were not requested for
+                # display, so it could be anything.
+                fm.data(itemtype=b'file', path=f, unresolved=True)
+
         else:
             msg = _(b'No unresolved merge conflicts.')