hgext3rd/topic/server.py
branchstable
changeset 5353 f32d4c7f8fb7
parent 5193 a4d081923c81
--- a/hgext3rd/topic/server.py	Mon Apr 20 00:05:05 2020 +0800
+++ b/hgext3rd/topic/server.py	Fri May 08 18:22:26 2020 +0800
@@ -10,14 +10,13 @@
     wireprotov1server,
 )
 
-
 try:
     from mercurial.utils import (
         repoviewutil,
     )
     repoviewutil.subsettable
 except (AttributeError, ImportError):
-    # hg <= 4.8
+    # hg <= 4.9 (caebe5e7f4bd)
     from mercurial import branchmap as repoviewutil
 
 from . import (
@@ -54,14 +53,6 @@
         filteredrevs = frozenset(filteredrevs | extrafiltered)
     return filteredrevs
 
-def wireprotocommand(name, args=b'', permission=b'pull'):
-    try:
-        from mercurial.wireprotov1server import wireprotocommand
-    except (ImportError, AttributeError):
-        # hg <= 4.6 (b4d85bc122bd)
-        from mercurial.wireproto import wireprotocommand
-    return wireprotocommand(name, args, permission=permission)
-
 def wrapheads(orig, repo, proto):
     """wrap head to hide topic^W draft changeset to old client"""
     hidetopics = repo.ui.configbool(b'experimental', b'topic.server-gate-topic-changesets')
@@ -85,8 +76,8 @@
 def setupserver(ui):
     extensions.wrapfunction(wireprotov1server, 'heads', wrapheads)
     wireprotov1server.commands.pop(b'heads')
-    wireprotocommand(b'heads', permission=b'pull')(wireprotov1server.heads)
-    wireprotocommand(b'_exttopics_heads', permission=b'pull')(topicheads)
+    wireprotov1server.wireprotocommand(b'heads', permission=b'pull')(wireprotov1server.heads)
+    wireprotov1server.wireprotocommand(b'_exttopics_heads', permission=b'pull')(topicheads)
     extensions.wrapfunction(wireprotov1server, '_capabilities', wireprotocaps)
 
     class topicpeerexecutor(wireprotov1peer.peerexecutor):