--- a/src/topic/__init__.py Sat Mar 12 15:36:17 2016 +0000
+++ b/src/topic/__init__.py Sat Mar 12 18:19:27 2016 +0000
@@ -13,11 +13,14 @@
import functools
from mercurial.i18n import _
+from mercurial import branchmap
from mercurial import cmdutil
from mercurial import commands
from mercurial import context
+from mercurial import discovery as discoverymod
from mercurial import error
from mercurial import extensions
+from mercurial import localrepo
from mercurial import lock
from mercurial import merge
from mercurial import namespaces
@@ -26,12 +29,13 @@
from mercurial import patch
from mercurial import phases
from mercurial import util
-from mercurial import branchmap
+from mercurial import wireproto
from . import constants
from . import revset as topicrevset
from . import destination
from . import topicmap
+from . import discovery
cmdtable = {}
command = cmdutil.command(cmdtable)
@@ -58,6 +62,8 @@
def reposetup(ui, repo):
orig = repo.__class__
+ if not isinstance(repo, localrepo.localrepository):
+ return # this can be a peer in the ssh case (puzzling)
class topicrepo(repo.__class__):
def commit(self, *args, **kwargs):
backup = self.ui.backupconfig('ui', 'allowemptycommit')
@@ -117,6 +123,17 @@
if '_topiccaches' in vars(self.unfiltered()):
self.unfiltered()._topiccaches.clear()
+ def peer(self):
+ peer = super(topicrepo, self).peer()
+ if getattr(peer, '_repo', None) is not None: # localpeer
+ class topicpeer(peer.__class__):
+ def branchmap(self):
+ usetopic = not self._repo.publishing()
+ return self._repo.branchmap(topic=usetopic)
+ peer.__class__ = topicpeer
+ return peer
+
+
repo.__class__ = topicrepo
if util.safehasattr(repo, 'names'):
repo.names.addnamespace(namespaces.namespace(
@@ -276,6 +293,8 @@
extensions.wrapfunction(cmdutil, 'buildcommittext', committextwrap)
extensions.wrapfunction(merge, 'update', mergeupdatewrap)
+extensions.wrapfunction(discoverymod, '_headssummary', discovery._headssummary)
+extensions.wrapfunction(wireproto, 'branchmap', discovery.wireprotobranchmap)
topicrevset.modsetup()
cmdutil.summaryhooks.add('topic', summaryhook)