diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -71,6 +71,7 @@ txnutil, util, vfs as vfsmod, + wireprototypes, ) from .interfaces import ( @@ -1473,6 +1474,8 @@ bundle2.getrepocaps(self, role=b'client') ) caps.add(b'bundle2=' + urlreq.quote(capsblob)) + if self.ui.configbool(b'experimental', b'narrow'): + caps.add(wireprototypes.NARROWCAP) return caps # Don't cache auditor/nofsauditor, or you'll end up with reference cycle: diff --git a/tests/test-narrow-clone.t b/tests/test-narrow-clone.t --- a/tests/test-narrow-clone.t +++ b/tests/test-narrow-clone.t @@ -62,15 +62,17 @@ $ cd .. -BUG: local-to-local narrow clones should work, but don't. +local-to-local narrow clones work $ hg clone --narrow master narrow-via-localpeer --noupdate --include "dir/src/f10" requesting all changes - abort: server does not support narrow clones - [255] + adding changesets + adding manifests + adding file changes + added 3 changesets with 1 changes to 1 files + new changesets 5d21aaea77f8:26ce255d5b5d $ hg tracked -R narrow-via-localpeer - abort: repository narrow-via-localpeer not found - [255] + I path:dir/src/f10 $ rm -Rf narrow-via-localpeer narrow clone with a newline should fail diff --git a/tests/test-narrow.t b/tests/test-narrow.t --- a/tests/test-narrow.t +++ b/tests/test-narrow.t @@ -61,7 +61,7 @@ [255] Names with '.' in them are OK. - $ hg clone --narrow ssh://user@dummy/master should-work --include a/.b/c + $ hg clone --narrow ./master should-work --include a/.b/c requesting all changes adding changesets adding manifests