Mercurial > evolve
comparison tests/test-topic-stack.t @ 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 | db617700d318 |
children | 5737e0680f10 |
comparison
equal
deleted
inserted
replaced
2331:d49f376598f8 | 2341:a5117a5becf8 |
---|---|
75 t4@ c_f (current) | 75 t4@ c_f (current) |
76 t3: c_e | 76 t3: c_e |
77 t2: c_d | 77 t2: c_d |
78 t1: c_c | 78 t1: c_c |
79 ^ c_b | 79 ^ c_b |
80 $ hg stack -Tjson | python -m json.tool | |
81 [ | |
82 { | |
83 "isentry": true, | |
84 "topic.stack.desc": "c_f", | |
85 "topic.stack.index": 4, | |
86 "topic.stack.state": "current", | |
87 "topic.stack.state.symbol": "@" | |
88 }, | |
89 { | |
90 "isentry": true, | |
91 "topic.stack.desc": "c_e", | |
92 "topic.stack.index": 3, | |
93 "topic.stack.state": "clean", | |
94 "topic.stack.state.symbol": ":" | |
95 }, | |
96 { | |
97 "isentry": true, | |
98 "topic.stack.desc": "c_d", | |
99 "topic.stack.index": 2, | |
100 "topic.stack.state": "clean", | |
101 "topic.stack.state.symbol": ":" | |
102 }, | |
103 { | |
104 "isentry": true, | |
105 "topic.stack.desc": "c_c", | |
106 "topic.stack.index": 1, | |
107 "topic.stack.state": "clean", | |
108 "topic.stack.state.symbol": ":" | |
109 }, | |
110 { | |
111 "isentry": false, | |
112 "topic.stack.desc": "c_b", | |
113 "topic.stack.state": "base", | |
114 "topic.stack.state.symbol": "^" | |
115 } | |
116 ] | |
80 | 117 |
81 error case, nothing to list | 118 error case, nothing to list |
82 | 119 |
83 $ hg topic --clear | 120 $ hg topic --clear |
84 $ hg stack | 121 $ hg stack |