status: outputting structured unfinished-operation information
This adds a new item in the json/template output for morestatus and added item
types to all entries.
Differential Revision: https://phab.mercurial-scm.org/D7595
--- a/mercurial/cmdutil.py Thu Dec 05 14:28:21 2019 -0800
+++ b/mercurial/cmdutil.py Mon Dec 09 22:24:58 2019 -0800
@@ -793,6 +793,13 @@
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
--- a/mercurial/commands.py Thu Dec 05 14:28:21 2019 -0800
+++ b/mercurial/commands.py Mon Dec 09 22:24:58 2019 -0800
@@ -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:
--- a/tests/test-conflict.t Thu Dec 05 14:28:21 2019 -0800
+++ b/tests/test-conflict.t Mon Dec 09 22:24:58 2019 -0800
@@ -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"
}
]
--- a/tests/test-status.t Thu Dec 05 14:28:21 2019 -0800
+++ b/tests/test-status.t Mon Dec 09 22:24:58 2019 -0800
@@ -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'
},