Mercurial > evolve
changeset 1999:fe76e9c92fff
init: cache repo.topics
author | timeless@gmail.com |
---|---|
date | Fri, 26 Aug 2016 16:52:02 +0000 |
parents | 302be26a3fd8 |
children | c413e7c96265 |
files | hgext3rd/topic/__init__.py |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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,