Mercurial > evolve
diff hgext3rd/topic/stack.py @ 2341:a5117a5becf8 stable
ui: Fix hg stack json output
Previously 'hg stack -Tjson' generated invalid output
like:
[
{
"isentry": true,
"topic.stack.desc": "...",
"topic.stack.index": 1,
"topic.stack.state": "current",
"topic.stack.state.symbol": "@"
}
]
,
{
"isentry": true,
"topic.stack.desc": "...",
"topic.stack.index": 1,
"topic.stack.state": "current",
"topic.stack.state.symbol": "@"
},
{
"isentry": false,
"topic.stack.desc": "...",
"topic.stack.state": "base",
"topic.stack.state.symbol": "^"
}
]
I de-indented the fmt.end() to generate this output:
[
{
"isentry": true,
"topic.stack.desc": "...",
"topic.stack.index": 1,
"topic.stack.state": "current",
"topic.stack.state.symbol": "@"
},
{
"isentry": false,
"topic.stack.desc": "...",
"topic.stack.state": "base",
"topic.stack.state.symbol": "^"
}
]
I've also added a test case.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 10 May 2017 09:55:22 +0200 |
parents | 61d595ce8994 |
children | 5737e0680f10 |
line wrap: on
line diff
--- a/hgext3rd/topic/stack.py Thu May 04 21:21:59 2017 +0200 +++ b/hgext3rd/topic/stack.py Wed May 10 09:55:22 2017 +0200 @@ -87,7 +87,7 @@ ' (%s)', state, label='topic.stack.state topic.stack.state.%s' % state) fm.plain('\n') - fm.end() + fm.end() def stackdata(repo, topic): """get various data about a stack