Patchwork D7595: status: outputting structured unfinished-operation information

login
register
mail settings
Submitter phabricator
Date Dec. 12, 2019, 6:40 a.m.
Message ID <46a59cfec80f5b91341b9b31d31d60b4@localhost.localdomain>
Download mbox | patch
Permalink /patch/43730/
State Not Applicable
Headers show

Comments

phabricator - Dec. 12, 2019, 6:40 a.m.
rdamazio edited the summary of this revision.
rdamazio marked an inline comment as done.
rdamazio updated this revision to Diff 18625.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7595?vs=18588&id=18625

BRANCH
  default

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

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  tests/test-conflict.t
  tests/test-status.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-status.t b/tests/test-status.t
--- a/tests/test-status.t
+++ b/tests/test-status.t
@@ -254,35 +254,43 @@ 
   $ hg status -A -Tjson
   [
    {
+    "itemtype": "file",
     "path": "added",
     "status": "A"
    },
    {
+    "itemtype": "file",
     "path": "copied",
     "source": "modified",
     "status": "A"
    },
    {
+    "itemtype": "file",
     "path": "removed",
     "status": "R"
    },
    {
+    "itemtype": "file",
     "path": "deleted",
     "status": "!"
    },
    {
+    "itemtype": "file",
     "path": "unknown",
     "status": "?"
    },
    {
+    "itemtype": "file",
     "path": "ignored",
     "status": "I"
    },
    {
+    "itemtype": "file",
     "path": ".hgignore",
     "status": "C"
    },
    {
+    "itemtype": "file",
     "path": "modified",
     "status": "C"
    }
@@ -558,6 +566,7 @@ 
   $ hg status --config ui.formatdebug=True --rev 1 1
   status = [
       {
+          'itemtype': 'file',
           'path': '1/2/3/4/5/b.txt',
           'status': 'R'
       },
diff --git a/tests/test-conflict.t b/tests/test-conflict.t
--- a/tests/test-conflict.t
+++ b/tests/test-conflict.t
@@ -63,13 +63,20 @@ 
   $ hg status -Tjson
   [
    {
+    "itemtype": "file",
     "path": "a",
     "status": "M",
     "unresolved": true
    },
    {
+    "itemtype": "file",
     "path": "a.orig",
     "status": "?"
+   },
+   {
+    "itemtype": "morestatus",
+    "unfinished": "merge",
+    "unfinishedmsg": "To continue:    hg commit\nTo abort:       hg merge --abort"
    }
   ]
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6884,7 +6884,7 @@ 
             for f in files:
                 fm.startitem()
                 fm.context(ctx=ctx2)
-                fm.data(path=f)
+                fm.data(itemtype=b'file', path=f)
                 fm.condwrite(showchar, b'status', b'%s ', char, label=label)
                 fm.plain(fmt % uipathfn(f), label=label)
                 if f in copy:
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -793,6 +793,10 @@ 
             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)