# HG changeset patch # User Pierre-Yves David # Date 1608764065 -3600 # Node ID 5cbf9c2189fd5874fffb28ee3b2c7343347d197e # Parent 15534a82f2cb5e6a439ee844f5c9bf01dc533614 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). diff -r 15534a82f2cb -r 5cbf9c2189fd hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Tue Jan 12 02:03:43 2021 +0800 +++ b/hgext3rd/topic/__init__.py Wed Dec 23 23:54:25 2020 +0100 @@ -294,7 +294,11 @@ def _contexttopic(self, force=False): if not (force or self.mutable()): return b'' - topic = self._repo._topiccache.get(self.rev()) + cache = getattr(self._repo, '_topiccache', None) + # topic loaded, but not enabled (eg: multiple repo in the same process) + if cache is None: + return b'' + topic = cache.get(self.rev()) if topic is None: topic = self.extra().get(constants.extrakey, b'') self._repo._topiccache[self.rev()] = topic