Mercurial > public > mercurial-scm > evolve
diff hgext3rd/topic/__init__.py @ 3060:f43a310c4338
topics: show changesetcount, troubledcount and headscount by default
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 13 Oct 2017 10:18:52 +0530 |
parents | 02b220984b01 |
children | 0cd594fdfd75 |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py Fri Oct 13 10:01:38 2017 +0530 +++ b/hgext3rd/topic/__init__.py Fri Oct 13 10:18:52 2017 +0530 @@ -762,7 +762,7 @@ return _showlasttouched(repo, fm, opts) activetopic = repo.currenttopic namemask = '%s' - if repo.topics and ui.verbose: + if repo.topics: maxwidth = max(len(t) for t in repo.topics) namemask = '%%-%is' % maxwidth for topic in sorted(repo.topics): @@ -778,31 +778,33 @@ fm.plain(' %s ' % marker, label=label) fm.write('topic', namemask, topic, label=label) fm.data(active=active) + + data = stack.stack(repo, topic=topic) + fm.plain(' (') if ui.verbose: - # XXX we should include the data even when not verbose - data = stack.stack(repo, topic=topic) - - fm.plain(' (') fm.write('branches+', 'on branch: %s', '+'.join(data.branches), # XXX use list directly after 4.0 is released label='topic.list.branches') fm.plain(', ') - fm.write('changesetcount', '%d changesets', data.changesetcount, - label='topic.list.changesetcount') + fm.write('changesetcount', '%d changesets', data.changesetcount, + label='topic.list.changesetcount') + + if data.troubledcount: + fm.plain(', ') + fm.write('troubledcount', '%d troubled', + data.troubledcount, + label='topic.list.troubledcount') - if data.troubledcount: - fm.plain(', ') - fm.write('troubledcount', '%d troubled', - data.troubledcount, - label='topic.list.troubledcount') + headcount = len(data.heads) + if 1 < headcount: + fm.plain(', ') + fm.write('headcount', '%d heads', + headcount, + label='topic.list.headcount.multiple') - headcount = len(data.heads) - if 1 < headcount: - fm.plain(', ') - fm.write('headcount', '%d heads', - headcount, - label='topic.list.headcount.multiple') + if ui.verbose: + # XXX we should include the data even when not verbose behindcount = data.behindcount if 0 < behindcount: @@ -815,8 +817,7 @@ fm.write('behinderror', '%s', _('ambiguous destination: %s') % data.behinderror, label='topic.list.behinderror') - fm.plain(')') - fm.plain('\n') + fm.plain(')\n') fm.end() def _showlasttouched(repo, fm, opts):