Mercurial > evolve
diff hgext3rd/topic/__init__.py @ 1987:d427fd97c9d5
topic: properly justify the verbose data when listing topic
We align all data to the widest topic.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Tue, 16 Aug 2016 15:43:06 +0200 |
parents | 03d6b685c16a |
children | 9a5d797d25be |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py Tue Aug 16 15:32:54 2016 +0200 +++ b/hgext3rd/topic/__init__.py Tue Aug 16 15:43:06 2016 +0200 @@ -280,6 +280,10 @@ def _listtopics(ui, repo, opts): fm = ui.formatter('bookmarks', opts) activetopic = repo.currenttopic + namemask = '%s' + if repo.topics and ui.verbose: + maxwidth = max(len(t) for t in repo.topics) + namemask = '%%-%is' % maxwidth for topic in sorted(repo.topics): fm.startitem() marker = ' ' @@ -291,12 +295,12 @@ if not ui.quiet: # registering the active data is made explicitly later fm.plain(' %s ' % marker, label=label) - fm.write('topic', '%s', topic, label=label) + fm.write('topic', namemask, topic, label=label) fm.data(active=active) if ui.verbose: # XXX we should include the data even when not verbose data = stack.stackdata(repo, topic) - fm.plain('\t(') + fm.plain(' (') fm.write('changesetcount', '%d changesets', data['changesetcount'], label='topic.list.changesetcount') if data['troubledcount']: