Mercurial > evolve
changeset 4655:bb0a5beb0ad8
stack: remove unnecessary prefix from stack output with non-default --template
"index" template keyword already exists (the current iteration of the loop), so
"stack_index" it is. It follows the same convention as other template keywords,
such as "files_added", "line_number", etc.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Fri, 17 May 2019 17:42:06 +0800 |
parents | 0d05dcb8dd37 |
children | dbf676c86244 |
files | hgext3rd/topic/stack.py tests/test-topic-stack.t |
diffstat | 2 files changed, 50 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/stack.py Fri May 17 17:59:58 2019 +0800 +++ b/hgext3rd/topic/stack.py Fri May 17 17:42:06 2019 +0800 @@ -362,17 +362,17 @@ if ui.verbose: fm.plain(' ') else: - fm.write('topic.stack.index', '%s%%d' % prefix, idx, + fm.write('stack_index', '%s%%d' % prefix, idx, label=labelsgen('topic.stack.index', states)) if ui.verbose: - fm.write('topic.stack.shortnode', '(%s)', short(ctx.node()), + fm.write('node', '(%s)', short(ctx.node()), label=labelsgen('topic.stack.shortnode', states)) - fm.write('topic.stack.state.symbol', '%s', symbol, + fm.write('symbol', '%s', symbol, label=labelsgen('topic.stack.state', states)) fm.plain(' ') - fm.write('topic.stack.desc', '%s', ctx.description().splitlines()[0], + fm.write('desc', '%s', ctx.description().splitlines()[0], label=labelsgen('topic.stack.desc', states)) - fm.condwrite(states != ['clean'] and idx is not None, 'topic.stack.state', + fm.condwrite(states != ['clean'] and idx is not None, 'state', ' (%s)', fm.formatlist(states, 'topic.stack.state'), label=labelsgen('topic.stack.state', states)) fm.plain('\n')
--- a/tests/test-topic-stack.t Fri May 17 17:59:58 2019 +0800 +++ b/tests/test-topic-stack.t Fri May 17 17:42:06 2019 +0800 @@ -107,102 +107,102 @@ $ hg stack -Tjson | python -m json.tool [ { + "desc": "c_f", "isentry": true, - "topic.stack.desc": "c_f", - "topic.stack.index": 4, - "topic.stack.state": [ + "stack_index": 4, + "state": [ "current" ], - "topic.stack.state.symbol": "@" + "symbol": "@" }, { + "desc": "c_e", "isentry": true, - "topic.stack.desc": "c_e", - "topic.stack.index": 3, - "topic.stack.state": [ + "stack_index": 3, + "state": [ "clean" ], - "topic.stack.state.symbol": ":" + "symbol": ":" }, { + "desc": "c_d", "isentry": true, - "topic.stack.desc": "c_d", - "topic.stack.index": 2, - "topic.stack.state": [ + "stack_index": 2, + "state": [ "clean" ], - "topic.stack.state.symbol": ":" + "symbol": ":" }, { + "desc": "c_c", "isentry": true, - "topic.stack.desc": "c_c", - "topic.stack.index": 1, - "topic.stack.state": [ + "stack_index": 1, + "state": [ "clean" ], - "topic.stack.state.symbol": ":" + "symbol": ":" }, { + "desc": "c_b", "isentry": false, - "topic.stack.desc": "c_b", - "topic.stack.index": 0, - "topic.stack.state": [ + "stack_index": 0, + "state": [ "base" ], - "topic.stack.state.symbol": "^" + "symbol": "^" } ] $ hg stack -v -Tjson | python -m json.tool [ { + "desc": "c_f", "isentry": true, - "topic.stack.desc": "c_f", - "topic.stack.index": 4, - "topic.stack.shortnode": "6559e6d93aea", - "topic.stack.state": [ + "node": "6559e6d93aea", + "stack_index": 4, + "state": [ "current" ], - "topic.stack.state.symbol": "@" + "symbol": "@" }, { + "desc": "c_e", "isentry": true, - "topic.stack.desc": "c_e", - "topic.stack.index": 3, - "topic.stack.shortnode": "0f9ac936c87d", - "topic.stack.state": [ + "node": "0f9ac936c87d", + "stack_index": 3, + "state": [ "clean" ], - "topic.stack.state.symbol": ":" + "symbol": ":" }, { + "desc": "c_d", "isentry": true, - "topic.stack.desc": "c_d", - "topic.stack.index": 2, - "topic.stack.shortnode": "e629654d7050", - "topic.stack.state": [ + "node": "e629654d7050", + "stack_index": 2, + "state": [ "clean" ], - "topic.stack.state.symbol": ":" + "symbol": ":" }, { + "desc": "c_c", "isentry": true, - "topic.stack.desc": "c_c", - "topic.stack.index": 1, - "topic.stack.shortnode": "8522f9e3fee9", - "topic.stack.state": [ + "node": "8522f9e3fee9", + "stack_index": 1, + "state": [ "clean" ], - "topic.stack.state.symbol": ":" + "symbol": ":" }, { + "desc": "c_b", "isentry": false, - "topic.stack.desc": "c_b", - "topic.stack.index": 0, - "topic.stack.shortnode": "ea705abc4f51", - "topic.stack.state": [ + "node": "ea705abc4f51", + "stack_index": 0, + "state": [ "base" ], - "topic.stack.state.symbol": "^" + "symbol": "^" } ]