# HG changeset patch # User Pierre-Yves David # Date 1657266612 -7200 # Node ID 00d1551bfa8cf5efae90bfb41d8b69a32c74636a # Parent 16f6b18b9ec025b0f1a88bc85e3887e2d6b394e8 topic: actually wrap branchmap wire-protocol command diff -r 16f6b18b9ec0 -r 00d1551bfa8c hgext3rd/topic/discovery.py --- a/hgext3rd/topic/discovery.py Fri Jul 08 17:52:25 2022 +0400 +++ b/hgext3rd/topic/discovery.py Fri Jul 08 09:50:12 2022 +0200 @@ -158,17 +158,21 @@ def wireprotobranchmap(orig, repo, proto): if not common.hastopicext(repo): return orig(repo, proto) - oldrepo = repo.__class__ + unfi = repo.unfiltered() + oldrepocls = unfi.__class__ try: - class repocls(repo.__class__): + class repocls(oldrepocls): def branchmap(self): usetopic = not self.publishing() return super(repocls, self).branchmap(topic=usetopic) - repo.__class__ = repocls + unfi.__class__ = repocls + if repo.filtername is not None: + repo = unfi.filtered(repo.filtername) + else: + repo = unfi return orig(repo, proto) finally: - repo.__class__ = oldrepo - + unfi.__class__ = oldrepocls def _get_branch_name(ctx): # make it easy for extension with the branch logic there @@ -308,6 +312,8 @@ """run at uisetup time to install all destinations wrapping""" extensions.wrapfunction(discovery, '_headssummary', _headssummary) extensions.wrapfunction(wireprotov1server, 'branchmap', wireprotobranchmap) + wireprotov1server.commands.pop(b'branchmap') + wireprotov1server.wireprotocommand(b'branchmap', permission=b'pull')(wireprotov1server.branchmap) extensions.wrapfunction(wireprotov1server, '_capabilities', wireprotocaps) # we need a proper wrap b2 part stuff extensions.wrapfunction(bundle2, 'handlecheckheads', handlecheckheads)