# HG changeset patch # User Pulkit Goyal # Date 1538259155 -19800 # Node ID d5498db5f86a7f151176d0a2a02f76f2d8a19e59 # Parent e743907d09325f0663f69e9cbd16282bd28ec882 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 diff -r e743907d0932 -r d5498db5f86a hgext/narrow/narrowcommands.py --- 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 diff -r e743907d0932 -r d5498db5f86a hgext/narrow/narrowrepo.py --- 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 diff -r e743907d0932 -r d5498db5f86a hgext/narrow/narrowwirepeer.py --- 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 diff -r e743907d0932 -r d5498db5f86a mercurial/wireprotoserver.py --- 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