topics: use stack rather than stackdata when one only wants the changeset count
There might be a significant performance impact.
Might resolve #309.
--- a/hgext3rd/topic/__init__.py Sat Sep 30 11:11:04 2017 +0100
+++ b/hgext3rd/topic/__init__.py Mon Oct 09 17:42:30 2017 +0200
@@ -322,14 +322,14 @@
ct = self.currenttopic
if not ct:
return tr
- ctwasempty = stack.stackdata(self, topic=ct)['changesetcount'] == 0
+ ctwasempty = stack.stack(self, topic=ct).changesetcount == 0
reporef = weakref.ref(self)
def currenttopicempty(tr):
# check active topic emptyness
repo = reporef()
- csetcount = stack.stackdata(repo, topic=ct)['changesetcount']
+ csetcount = stack.stack(repo, topic=ct).changesetcount
empty = csetcount == 0
if empty and not ctwasempty:
ui.status('active topic %r is now empty\n' % ct)
@@ -480,7 +480,7 @@
ct = repo.currenttopic
if clear:
- empty = stack.stackdata(repo, topic=ct)['changesetcount'] == 0
+ empty = stack.stack(repo, topic=ct).changesetcount == 0
if empty:
if ct:
ui.status(_('clearing empty topic "%s"\n') % ct)
@@ -917,7 +917,7 @@
# rebased commit. We have explicitly stored in config if rebase is
# running.
ot = repo.currenttopic
- empty = stack.stackdata(repo, topic=ot)['changesetcount'] == 0
+ empty = stack.stack(repo, topic=ot).changesetcount == 0
if repo.ui.hasconfig('experimental', 'topicrebase'):
isrebase = True
if repo.ui.configbool('_internal', 'keep-topic'):