diff --git a/hgext/narrow/TODO.rst b/hgext/narrow/TODO.rst --- a/hgext/narrow/TODO.rst +++ b/hgext/narrow/TODO.rst @@ -28,10 +28,3 @@ format. narrowrepo.setnarrowpats() or narrowspec.save() need to make sure they're holding the wlock. - -Implement a simple version of the expandnarrow wireproto command for -core. Having configurable shorthands for narrowspecs has been useful -at Google (and sparse has a similar feature from Facebook), so it -probably makes sense to implement the feature in core. (Google's -handler is entirely custom to Google, with a custom format related to -bazel's build language, so it's not in the narrowhg distribution.) diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -62,25 +62,6 @@ def setup(): extensions.wrapcommand(commands.table, 'archive', archivenarrowcmd) -def expandpull(pullop, includepats, excludepats): - if not narrowspec.needsexpansion(includepats): - return includepats, excludepats - - heads = pullop.heads or pullop.rheads - includepats, excludepats = pullop.remote.expandnarrow( - includepats, excludepats, heads) - pullop.repo.ui.debug('Expanded narrowspec to inc=%s, exc=%s\n' % ( - includepats, excludepats)) - - includepats = set(includepats) - excludepats = set(excludepats) - - # Nefarious remote could supply unsafe patterns. Validate them. - narrowspec.validatepatterns(includepats) - narrowspec.validatepatterns(excludepats) - - return includepats, excludepats - def clonenarrowcmd(orig, ui, repo, *args, **opts): """Wraps clone command, so 'hg clone' first wraps localrepo.clone().""" opts = pycompat.byteskwargs(opts) @@ -116,10 +97,6 @@ def clonenarrowcmd(orig, ui, repo, *args includepats = narrowspec.parsepatterns(opts['include']) excludepats = narrowspec.parsepatterns(opts['exclude']) - # If necessary, ask the server to expand the narrowspec. - includepats, excludepats = expandpull( - pullop, includepats, excludepats) - if not includepats and excludepats: # If nothing was included, we assume the user meant to include # everything, except what they asked to exclude. @@ -292,10 +269,6 @@ def _narrow(ui, repo, remote, commoninc, def _widen(ui, repo, remote, commoninc, newincludes, newexcludes): newmatch = narrowspec.match(repo.root, newincludes, newexcludes) - # TODO(martinvonz): Get expansion working with widening/narrowing. - if narrowspec.needsexpansion(newincludes): - raise error.Abort('Expansion not yet supported on pull') - def pullbundle2extraprepare_widen(orig, pullop, kwargs): orig(pullop, kwargs) # The old{in,ex}cludepats have already been set by orig() @@ -402,9 +375,6 @@ def trackedcmd(ui, repo, remotepath=None opts['addinclude'].extend(includepats) opts['addexclude'].extend(excludepats) - if narrowspec.needsexpansion(opts['addinclude'] + opts['addexclude']): - raise error.Abort('Expansion not yet supported on widen/narrow') - addedincludes = narrowspec.parsepatterns(opts['addinclude']) removedincludes = narrowspec.parsepatterns(opts['removeinclude']) addedexcludes = narrowspec.parsepatterns(opts['addexclude']) diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -7,13 +7,9 @@ from __future__ import absolute_import -from mercurial.i18n import _ from mercurial import ( - error, extensions, hg, - narrowspec, - node, wireprotov1server, ) @@ -21,27 +17,6 @@ NARROWCAP = 'exp-narrow-1' ELLIPSESCAP = 'exp-ellipses-1' def uisetup(): - def peersetup(ui, peer): - # We must set up the expansion before reposetup below, since it's used - # at clone time before we have a repo. - class expandingpeer(peer.__class__): - def expandnarrow(self, narrow_include, narrow_exclude, nodes): - ui.status(_("expanding narrowspec\n")) - if not self.capable('exp-expandnarrow'): - raise error.Abort( - 'peer does not support expanding narrowspecs') - - hex_nodes = (node.hex(n) for n in nodes) - new_narrowspec = self._call( - 'expandnarrow', - includepats=','.join(narrow_include), - excludepats=','.join(narrow_exclude), - nodes=','.join(hex_nodes)) - - return narrowspec.parseserverpatterns(new_narrowspec) - peer.__class__ = expandingpeer - hg.wirepeersetupfuncs.append(peersetup) - extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) def addnarrowcap(orig, repo, proto): diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py --- a/mercurial/narrowspec.py +++ b/mercurial/narrowspec.py @@ -146,9 +146,6 @@ def match(root, include=None, exclude=No return matchmod.match(root, '', [], include=include or [], exclude=exclude or []) -def needsexpansion(includes): - return [i for i in includes if i.startswith('include:')] - def load(repo): try: spec = repo.svfs.read(FILENAME)