narrow: move wire proto capabilities to narrowwirepeer
These are not bundle2 capabilities (they just happened to share the
name "narrow"), so they seem to belong with the wirepeer overrides.
Differential Revision: https://phab.mercurial-scm.org/D4528
--- a/hgext/narrow/narrowbundle2.py Tue Sep 11 11:03:15 2018 -0700
+++ b/hgext/narrow/narrowbundle2.py Tue Sep 11 10:50:46 2018 -0700
@@ -32,7 +32,6 @@
)
NARROWCAP = 'narrow'
-ELLIPSESCAP = 'ellipses'
_NARROWACL_SECTION = 'narrowhgacl'
_CHANGESPECPART = NARROWCAP + ':changespec'
_SPECPART = NARROWCAP + ':spec'
--- a/hgext/narrow/narrowcommands.py Tue Sep 11 11:03:15 2018 -0700
+++ b/hgext/narrow/narrowcommands.py Tue Sep 11 10:50:46 2018 -0700
@@ -32,7 +32,7 @@
)
from . import (
- narrowbundle2,
+ narrowwirepeer,
)
table = {}
@@ -171,7 +171,7 @@
if repository.NARROW_REQUIREMENT not in repo.requirements:
return orig(pullop, kwargs)
- if narrowbundle2.NARROWCAP not in pullop.remote.capabilities():
+ if narrowwirepeer.NARROWCAP not in pullop.remote.capabilities():
raise error.Abort(_("server doesn't support narrow clones"))
orig(pullop, kwargs)
kwargs['narrow'] = True
@@ -182,7 +182,7 @@
kwargs['excludepats'] = exclude
# calculate known nodes only in ellipses cases because in non-ellipses cases
# we have all the nodes
- if narrowbundle2.ELLIPSESCAP in pullop.remote.capabilities():
+ if narrowwirepeer.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 Tue Sep 11 11:03:15 2018 -0700
+++ b/hgext/narrow/narrowrepo.py Tue Sep 11 10:50:46 2018 -0700
@@ -8,9 +8,9 @@
from __future__ import absolute_import
from . import (
- narrowbundle2,
narrowdirstate,
narrowrevlog,
+ narrowwirepeer,
)
def wraprepo(repo):
@@ -29,8 +29,8 @@
def peer(self):
peer = super(narrowrepository, self).peer()
- peer._caps.add(narrowbundle2.NARROWCAP)
- peer._caps.add(narrowbundle2.ELLIPSESCAP)
+ peer._caps.add(narrowwirepeer.NARROWCAP)
+ peer._caps.add(narrowwirepeer.ELLIPSESCAP)
return peer
repo.__class__ = narrowrepository
--- a/hgext/narrow/narrowwirepeer.py Tue Sep 11 11:03:15 2018 -0700
+++ b/hgext/narrow/narrowwirepeer.py Tue Sep 11 10:50:46 2018 -0700
@@ -17,7 +17,8 @@
wireprotov1server,
)
-from . import narrowbundle2
+NARROWCAP = 'narrow'
+ELLIPSESCAP = 'ellipses'
def uisetup():
def peersetup(ui, peer):
@@ -46,9 +47,9 @@
def addnarrowcap(orig, repo, proto):
"""add the narrow capability to the server"""
caps = orig(repo, proto)
- caps.append(narrowbundle2.NARROWCAP)
+ caps.append(NARROWCAP)
if repo.ui.configbool('experimental', 'narrowservebrokenellipses'):
- caps.append(narrowbundle2.ELLIPSESCAP)
+ caps.append(ELLIPSESCAP)
return caps
def reposetup(repo):