[PATCH 1 of 2 topic-ext] init: cache repo.topics

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Aug 26 17:22:46 EDT 2016



On 08/26/2016 06:59 PM, timeless wrote:
> # HG changeset patch
> # User timeless at gmail.com
> # Date 1472230322 0
> #      Fri Aug 26 16:52:02 2016 +0000
> # Node ID 81def069bd64c516610e507279070cef5ca72d7f
> # Parent  cf9414f2b5cddd65d21041527981d15a6fb6fd67
> init: cache repo.topics

Thanks for looking into this. That turned out a less scary step that one 
might have expected :-)

> diff -r cf9414f2b5cd -r 81def069bd64 hgext3rd/topic/__init__.py
> --- a/hgext3rd/topic/__init__.py	Tue Aug 23 21:18:47 2016 +0200
> +++ b/hgext3rd/topic/__init__.py	Fri Aug 26 16:52:02 2016 +0000
> @@ -144,10 +144,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
> @@ -167,6 +170,7 @@
>
>          def invalidatecaches(self):
>              super(topicrepo, self).invalidatecaches()
> +            self._topics = None

I'm afraid this is a bit to weak as I'm not sure 'invalidatecaches' in 
called in all the necessary case. Using 'invalidatevolatilesets' -might- 
be a bit too much but will probably do the trick.

Eventually we should probably dig a bit more and document what to expect 
from the various cache invalidation level.

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list