# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1507869098 -19800 # Node ID 02b220984b012cea253e316660c5c8cc82e651b3 # Parent cb8ae3cb0bbc3fd830df589b1618834b91794c7b topics: use stack.stack() instead of stack.stackdata() stack.stackdata() also calls stack.stack() internally. Moreover if we just want to calculate changesetcount, troubled count, it will be cheap to calculate using stack.stack rather than stackdata(). diff -r cb8ae3cb0bbc -r 02b220984b01 hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Tue Oct 10 22:40:41 2017 +0200 +++ b/hgext3rd/topic/__init__.py Fri Oct 13 10:01:38 2017 +0530 @@ -780,33 +780,40 @@ fm.data(active=active) if ui.verbose: # XXX we should include the data even when not verbose - data = stack.stackdata(repo, topic=topic) + 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 + '+'.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'], + fm.write('changesetcount', '%d changesets', data.changesetcount, label='topic.list.changesetcount') - if data['troubledcount']: + + if data.troubledcount: fm.plain(', ') fm.write('troubledcount', '%d troubled', - data['troubledcount'], + data.troubledcount, label='topic.list.troubledcount') - if 1 < data['headcount']: + + headcount = len(data.heads) + if 1 < headcount: fm.plain(', ') fm.write('headcount', '%d heads', - data['headcount'], + headcount, label='topic.list.headcount.multiple') - if 0 < data['behindcount']: + + behindcount = data.behindcount + if 0 < behindcount: fm.plain(', ') fm.write('behindcount', '%d behind', - data['behindcount'], + behindcount, label='topic.list.behindcount') - elif -1 == data['behindcount']: + elif -1 == behindcount: fm.plain(', ') fm.write('behinderror', '%s', - _('ambiguous destination: %s') % data['behinderror'], + _('ambiguous destination: %s') % data.behinderror, label='topic.list.behinderror') fm.plain(')') fm.plain('\n')