diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -407,6 +407,13 @@ url, branches = hg.parseurl(remotepath) ui.status(_('comparing with %s\n') % util.hidepassword(url)) remote = hg.peer(repo, opts, url) + + # check narrow support before doing anything if widening needs to be + # performed. In future we should also abort if client is ellipses and + # server does not support ellipses + if widening and narrowwirepeer.NARROWCAP not in remote.capabilities(): + raise error.Abort(_("server does not support narrow clones")) + commoninc = discovery.findcommonincoming(repo, remote) oldincludes, oldexcludes = repo.narrowpats diff --git a/tests/test-narrow-clone-non-narrow-server.t b/tests/test-narrow-clone-non-narrow-server.t --- a/tests/test-narrow-clone-non-narrow-server.t +++ b/tests/test-narrow-clone-non-narrow-server.t @@ -60,7 +60,5 @@ looking for local changes to affected paths $ hg tracked --addinclude f1 http://localhost:$HGPORT1/ comparing with http://localhost:$HGPORT1/ - searching for changes - no changes found - abort: server doesn't support narrow clones + abort: server does not support narrow clones [255]