narrow: move the ellipses server capability to core
authorPulkit Goyal <pulkit@yandex-team.ru>
Sun, 30 Sep 2018 03:45:51 +0530
changeset 39934 a24f4638d6c1
parent 39933 d5498db5f86a
child 39935 cb9b23ec093c
narrow: move the ellipses server capability to core This will be used in core logic to determining whether a server is ellipses enabled or not. And also this will ease moving narrow related things to core. Differential Revision: https://phab.mercurial-scm.org/D4809
hgext/narrow/narrowcommands.py
hgext/narrow/narrowrepo.py
hgext/narrow/narrowwirepeer.py
mercurial/wireprotoserver.py
--- a/hgext/narrow/narrowcommands.py	Sun Sep 30 03:42:35 2018 +0530
+++ b/hgext/narrow/narrowcommands.py	Sun Sep 30 03:45:51 2018 +0530
@@ -32,10 +32,6 @@
     wireprotoserver,
 )
 
-from . import (
-    narrowwirepeer,
-)
-
 table = {}
 command = registrar.command(table)
 
@@ -148,7 +144,7 @@
     kwargs['excludepats'] = exclude
     # calculate known nodes only in ellipses cases because in non-ellipses cases
     # we have all the nodes
-    if narrowwirepeer.ELLIPSESCAP in pullop.remote.capabilities():
+    if wireprotoserver.ELLIPSESCAP in pullop.remote.capabilities():
         kwargs['known'] = [node.hex(ctx.node()) for ctx in
                            repo.set('::%ln', pullop.common)
                            if ctx.node() != node.nullid]
--- a/hgext/narrow/narrowrepo.py	Sun Sep 30 03:42:35 2018 +0530
+++ b/hgext/narrow/narrowrepo.py	Sun Sep 30 03:45:51 2018 +0530
@@ -13,7 +13,6 @@
 
 from . import (
     narrowdirstate,
-    narrowwirepeer,
 )
 
 def wraprepo(repo):
@@ -28,7 +27,7 @@
         def peer(self):
             peer = super(narrowrepository, self).peer()
             peer._caps.add(wireprotoserver.NARROWCAP)
-            peer._caps.add(narrowwirepeer.ELLIPSESCAP)
+            peer._caps.add(wireprotoserver.ELLIPSESCAP)
             return peer
 
     repo.__class__ = narrowrepository
--- a/hgext/narrow/narrowwirepeer.py	Sun Sep 30 03:42:35 2018 +0530
+++ b/hgext/narrow/narrowwirepeer.py	Sun Sep 30 03:45:51 2018 +0530
@@ -14,8 +14,6 @@
     wireprotov1server,
 )
 
-ELLIPSESCAP = 'exp-ellipses-1'
-
 def uisetup():
     extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap)
 
@@ -24,7 +22,7 @@
     caps = orig(repo, proto)
     caps.append(wireprotoserver.NARROWCAP)
     if repo.ui.configbool('experimental', 'narrowservebrokenellipses'):
-        caps.append(ELLIPSESCAP)
+        caps.append(wireprotoserver.ELLIPSESCAP)
     return caps
 
 def reposetup(repo):
--- a/mercurial/wireprotoserver.py	Sun Sep 30 03:42:35 2018 +0530
+++ b/mercurial/wireprotoserver.py	Sun Sep 30 03:45:51 2018 +0530
@@ -39,6 +39,7 @@
 HGERRTYPE = 'application/hg-error'
 
 NARROWCAP = 'exp-narrow-1'
+ELLIPSESCAP = 'exp-ellipses-1'
 
 SSHV1 = wireprototypes.SSHV1
 SSHV2 = wireprototypes.SSHV2