--- a/hgext3rd/topic/__init__.py Thu Jun 22 09:47:14 2017 +0200
+++ b/hgext3rd/topic/__init__.py Thu Jun 22 10:13:29 2017 +0200
@@ -56,7 +56,6 @@
from mercurial.i18n import _
from mercurial import (
- branchmap,
cmdutil,
commands,
context,
@@ -169,6 +168,8 @@
if not isinstance(repo, localrepo.localrepository):
return # this can be a peer in the ssh case (puzzling)
+ repo = repo.unfiltered()
+
if repo.ui.config('experimental', 'thg.displaynames', None) is None:
repo.ui.setconfig('experimental', 'thg.displaynames', 'topics',
source='topic-extension')
@@ -191,6 +192,11 @@
self.ui.restoreconfig(backup)
def commitctx(self, ctx, error=None):
+ topicfilter = topicmap.topicfilter(self.filtername)
+ if topicfilter != self.filtername:
+ other = repo.filtered(topicmap.topicfilter(repo.filtername))
+ other.commitctx(ctx, error=error)
+
if isinstance(ctx, context.workingcommitctx):
current = self.currenttopic
if current:
@@ -201,8 +207,7 @@
not self.currenttopic):
# we are amending and need to remove a topic
del ctx.extra()[constants.extrakey]
- with topicmap.usetopicmap(self):
- return super(topicrepo, self).commitctx(ctx, error=error)
+ return super(topicrepo, self).commitctx(ctx, error=error)
@property
def topics(self):
@@ -219,23 +224,21 @@
def currenttopic(self):
return self.vfs.tryread('topic')
- def branchmap(self, topic=True):
- if not topic:
- super(topicrepo, self).branchmap()
- with topicmap.usetopicmap(self):
- branchmap.updatecache(self)
- return self._topiccaches[self.filtername]
+ # overwritten at the instance level by topicmap.py
+ _autobranchmaptopic = True
- def destroyed(self, *args, **kwargs):
- with topicmap.usetopicmap(self):
- return super(topicrepo, self).destroyed(*args, **kwargs)
+ def branchmap(self, topic=None):
+ if topic is None:
+ topic = self._autobranchmaptopic
+ topicfilter = topicmap.topicfilter(self.filtername)
+ if not topic or topicfilter == self.filtername:
+ return super(topicrepo, self).branchmap()
+ return self.filtered(topicfilter).branchmap()
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()
def peer(self):
peer = super(topicrepo, self).peer()