Mercurial > evolve
comparison hgext3rd/topic/__init__.py @ 5701:5cbf9c2189fd
topic: fix the newly added cache for repository without topic
The context method might be wrapped without topic being installer. So we need to
deal with that case.
This might happen in some case where topic is loaded but not enabled (eg: two
repository in the same process).
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 23 Dec 2020 23:54:25 +0100 |
parents | d24669df9a4a |
children | 61d2f1cf90f0 |
comparison
equal
deleted
inserted
replaced
5700:15534a82f2cb | 5701:5cbf9c2189fd |
---|---|
292 ) | 292 ) |
293 | 293 |
294 def _contexttopic(self, force=False): | 294 def _contexttopic(self, force=False): |
295 if not (force or self.mutable()): | 295 if not (force or self.mutable()): |
296 return b'' | 296 return b'' |
297 topic = self._repo._topiccache.get(self.rev()) | 297 cache = getattr(self._repo, '_topiccache', None) |
298 # topic loaded, but not enabled (eg: multiple repo in the same process) | |
299 if cache is None: | |
300 return b'' | |
301 topic = cache.get(self.rev()) | |
298 if topic is None: | 302 if topic is None: |
299 topic = self.extra().get(constants.extrakey, b'') | 303 topic = self.extra().get(constants.extrakey, b'') |
300 self._repo._topiccache[self.rev()] = topic | 304 self._repo._topiccache[self.rev()] = topic |
301 return topic | 305 return topic |
302 | 306 |