topicmap: ensure that 'served' view is updated with topicmap
There is multiple place that explicitly update the 'served' branchmap to ensure
it stay up to date. We ensure it use the proper topicmap in this case.
--- a/src/topic/__init__.py Mon Mar 14 00:12:22 2016 +0000
+++ b/src/topic/__init__.py Mon Mar 14 00:15:54 2016 +0000
@@ -16,6 +16,7 @@
from mercurial.i18n import _
from mercurial import branchmap
from mercurial import bundle2
+from mercurial import changegroup
from mercurial import cmdutil
from mercurial import commands
from mercurial import context
@@ -80,6 +81,10 @@
branchmap.branchcache = oldbranchcache
branchmap._filename = oldfilename
+def cgapply(orig, repo, *args, **kwargs):
+ with usetopicmap(repo):
+ return orig(repo, *args, **kwargs)
+
def reposetup(ui, repo):
orig = repo.__class__
if not isinstance(repo, localrepo.localrepository):
@@ -106,7 +111,8 @@
not self.currenttopic):
# we are amending and need to remove a topic
del ctx.extra()[constants.extrakey]
- return orig.commitctx(self, ctx, error=error)
+ with usetopicmap(self):
+ return orig.commitctx(self, ctx, error=error)
@property
def topics(self):
@@ -127,6 +133,10 @@
branchmap.updatecache(self)
return self._topiccaches[self.filtername]
+ def destroyed(self, *args, **kwargs):
+ with usetopicmap(self):
+ return super(topicrepo, self).destroyed(*args, **kwargs)
+
def invalidatecaches(self):
super(topicrepo, self).invalidatecaches()
if '_topiccaches' in vars(self.unfiltered()):
@@ -308,6 +318,7 @@
bundle2.handlecheckheads.params = frozenset() # we need a proper wrape b2 part stuff
bundle2.parthandlermapping['check:heads'] = bundle2.handlecheckheads
extensions.wrapfunction(exchange, '_pushb2phases', discovery._pushb2phases)
+extensions.wrapfunction(changegroup.cg1unpacker, 'apply', cgapply)
exchange.b2partsgenmapping['phase'] = exchange._pushb2phases
topicrevset.modsetup()
cmdutil.summaryhooks.add('topic', summaryhook)