# HG changeset patch # User timeless@gmail.com # Date 1472230322 0 # Node ID fe76e9c92fff80f956dd92e10b177ec2a9bb8c4d # Parent 302be26a3fd8bcafa6609b3246cc4f3432a660e1 init: cache repo.topics diff -r 302be26a3fd8 -r fe76e9c92fff hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Fri Aug 26 21:57:48 2016 +0200 +++ b/hgext3rd/topic/__init__.py Fri Aug 26 16:52:02 2016 +0000 @@ -149,10 +149,13 @@ @property def topics(self): + if self._topics is not None: + return self._topics topics = set(['', self.currenttopic]) for c in self.set('not public()'): topics.add(c.topic()) topics.remove('') + self._topics = topics return topics @property @@ -170,8 +173,10 @@ with topicmap.usetopicmap(self): return super(topicrepo, self).destroyed(*args, **kwargs) - def invalidatecaches(self): - super(topicrepo, self).invalidatecaches() + def invalidatevolatilesets(self): + # XXX we might be able to move this to something invalidated less often + super(topicrepo, self).invalidatevolatilesets() + self._topics = None if '_topiccaches' in vars(self.unfiltered()): self.unfiltered()._topiccaches.clear() @@ -186,6 +191,7 @@ return peer repo.__class__ = topicrepo + repo._topics = None if util.safehasattr(repo, 'names'): repo.names.addnamespace(namespaces.namespace( 'topics', 'topic', namemap=_namemap, nodemap=_nodemap,