changeset 39938:d5498db5f86a

narrow: move the wireprotocol narrow capability name to core We are trying to integrate the whole of narrow logic into core and it will be helpful for upcoming patches to have these capability names in core. The next patch will move the ellipses capability to core also. The exact motivation is to know whether we are cloning a ellipses repo or not and adding an ellipses repo requirement. Differential Revision: https://phab.mercurial-scm.org/D4808
author Pulkit Goyal <pulkit@yandex-team.ru>
date Sun, 30 Sep 2018 03:42:35 +0530
parents e743907d0932
children a24f4638d6c1
files hgext/narrow/narrowcommands.py hgext/narrow/narrowrepo.py hgext/narrow/narrowwirepeer.py mercurial/wireprotoserver.py
diffstat 4 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/narrow/narrowcommands.py	Sun Sep 30 16:11:35 2018 +0900
+++ b/hgext/narrow/narrowcommands.py	Sun Sep 30 03:42:35 2018 +0530
@@ -29,6 +29,7 @@
     repoview,
     sparse,
     util,
+    wireprotoserver,
 )
 
 from . import (
@@ -136,7 +137,7 @@
     if repository.NARROW_REQUIREMENT not in repo.requirements:
         return orig(pullop, kwargs)
 
-    if narrowwirepeer.NARROWCAP not in pullop.remote.capabilities():
+    if wireprotoserver.NARROWCAP not in pullop.remote.capabilities():
         raise error.Abort(_("server doesn't support narrow clones"))
     orig(pullop, kwargs)
     kwargs['narrow'] = True
--- a/hgext/narrow/narrowrepo.py	Sun Sep 30 16:11:35 2018 +0900
+++ b/hgext/narrow/narrowrepo.py	Sun Sep 30 03:42:35 2018 +0530
@@ -7,6 +7,10 @@
 
 from __future__ import absolute_import
 
+from mercurial import (
+    wireprotoserver,
+)
+
 from . import (
     narrowdirstate,
     narrowwirepeer,
@@ -23,7 +27,7 @@
 
         def peer(self):
             peer = super(narrowrepository, self).peer()
-            peer._caps.add(narrowwirepeer.NARROWCAP)
+            peer._caps.add(wireprotoserver.NARROWCAP)
             peer._caps.add(narrowwirepeer.ELLIPSESCAP)
             return peer
 
--- a/hgext/narrow/narrowwirepeer.py	Sun Sep 30 16:11:35 2018 +0900
+++ b/hgext/narrow/narrowwirepeer.py	Sun Sep 30 03:42:35 2018 +0530
@@ -10,10 +10,10 @@
 from mercurial import (
     extensions,
     hg,
+    wireprotoserver,
     wireprotov1server,
 )
 
-NARROWCAP = 'exp-narrow-1'
 ELLIPSESCAP = 'exp-ellipses-1'
 
 def uisetup():
@@ -22,7 +22,7 @@
 def addnarrowcap(orig, repo, proto):
     """add the narrow capability to the server"""
     caps = orig(repo, proto)
-    caps.append(NARROWCAP)
+    caps.append(wireprotoserver.NARROWCAP)
     if repo.ui.configbool('experimental', 'narrowservebrokenellipses'):
         caps.append(ELLIPSESCAP)
     return caps
--- a/mercurial/wireprotoserver.py	Sun Sep 30 16:11:35 2018 +0900
+++ b/mercurial/wireprotoserver.py	Sun Sep 30 03:42:35 2018 +0530
@@ -38,6 +38,8 @@
 HGTYPE2 = 'application/mercurial-0.2'
 HGERRTYPE = 'application/hg-error'
 
+NARROWCAP = 'exp-narrow-1'
+
 SSHV1 = wireprototypes.SSHV1
 SSHV2 = wireprototypes.SSHV2