narrow: check "narrow" wire protocol capability, not bundle2 capability
It seems like the new "narrow" wire protocol capability should be what
determines if the server supports the "narrow" and
"{,old}{in,ex}cludepats" arguments to the getbundle request.
Differential Revision: https://phab.mercurial-scm.org/D4527
--- a/hgext/narrow/narrowcommands.py Tue Aug 21 16:11:17 2018 +0300
+++ b/hgext/narrow/narrowcommands.py Tue Sep 11 11:03:15 2018 -0700
@@ -171,7 +171,7 @@
if repository.NARROW_REQUIREMENT not in repo.requirements:
return orig(pullop, kwargs)
- if narrowbundle2.NARROWCAP not in pullop.remotebundle2caps:
+ if narrowbundle2.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 Tue Aug 21 16:11:17 2018 +0300
+++ b/hgext/narrow/narrowrepo.py Tue Sep 11 11:03:15 2018 -0700
@@ -8,6 +8,7 @@
from __future__ import absolute_import
from . import (
+ narrowbundle2,
narrowdirstate,
narrowrevlog,
)
@@ -26,4 +27,10 @@
dirstate = super(narrowrepository, self)._makedirstate()
return narrowdirstate.wrapdirstate(self, dirstate)
+ def peer(self):
+ peer = super(narrowrepository, self).peer()
+ peer._caps.add(narrowbundle2.NARROWCAP)
+ peer._caps.add(narrowbundle2.ELLIPSESCAP)
+ return peer
+
repo.__class__ = narrowrepository