D2201: narrowspec: move module into core
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9fd8c2a3db5a: narrowspec: move module into core (authored by indygreg, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D2201?vs=5570&id=5647#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2201?vs=5570&id=5647 REVISION DETAIL https://phab.mercurial-scm.org/D2201 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowcommands.py hgext/narrow/narrowdirstate.py hgext/narrow/narrowrepo.py hgext/narrow/narrowspec.py hgext/narrow/narrowwirepeer.py mercurial/narrowspec.py tests/test-narrow-expanddirstate.t CHANGE DETAILS diff --git a/tests/test-narrow-expanddirstate.t b/tests/test-narrow-expanddirstate.t --- a/tests/test-narrow-expanddirstate.t +++ b/tests/test-narrow-expanddirstate.t @@ -51,22 +51,22 @@ > from mercurial import extensions > from mercurial import localrepo > from mercurial import match as matchmod + > from mercurial import narrowspec > from mercurial import patch > from mercurial import util as hgutil > > def expandnarrowspec(ui, repo, newincludes=None): > if not newincludes: > return > import sys > newincludes = set([newincludes]) - > narrowhg = extensions.find('narrow') > includes, excludes = repo.narrowpats - > currentmatcher = narrowhg.narrowspec.match(repo.root, includes, excludes) + > currentmatcher = narrowspec.match(repo.root, includes, excludes) > includes = includes | newincludes > if not repo.currenttransaction(): > ui.develwarn('expandnarrowspec called outside of transaction!') > repo.setnarrowpats(includes, excludes) - > newmatcher = narrowhg.narrowspec.match(repo.root, includes, excludes) + > newmatcher = narrowspec.match(repo.root, includes, excludes) > added = matchmod.differencematcher(newmatcher, currentmatcher) > for f in repo['.'].manifest().walk(added): > repo.dirstate.normallookup(f) diff --git a/hgext/narrow/narrowspec.py b/mercurial/narrowspec.py rename from hgext/narrow/narrowspec.py rename to mercurial/narrowspec.py --- a/hgext/narrow/narrowspec.py +++ b/mercurial/narrowspec.py @@ -9,8 +9,8 @@ import errno -from mercurial.i18n import _ -from mercurial import ( +from .i18n import _ +from . import ( error, hg, match as matchmod, @@ -89,7 +89,7 @@ # We use newlines as separators in the narrowspec file, so don't allow them # in patterns. if _numlines(pat) > 1: -raise error.Abort('newlines are not allowed in narrowspec paths') +raise error.Abort(_('newlines are not allowed in narrowspec paths')) components = pat.split('/') if '.' in components or '..' in components: diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -12,11 +12,10 @@ error, extensions, hg, +narrowspec, node, ) -from . import narrowspec - def uisetup(): def peersetup(ui, peer): # We must set up the expansion before reposetup below, since it's used diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -12,12 +12,12 @@ hg, localrepo, match as matchmod, +narrowspec, scmutil, ) from . import ( narrowrevlog, -narrowspec, ) # When narrowing is finalized and no longer subject to format changes, diff --git a/hgext/narrow/narrowdirstate.py b/hgext/narrow/narrowdirstate.py --- a/hgext/narrow/narrowdirstate.py +++ b/hgext/narrow/narrowdirstate.py @@ -13,11 +13,10 @@ error, extensions, match as matchmod, +narrowspec, util as hgutil, ) -from . import narrowspec - def setup(repo): """Add narrow spec dirstate ignore, block changes outside narrow spec.""" diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -18,6 +18,7 @@ extensions, hg, merge, +narrowspec, node, pycompat, registrar, @@ -29,7 +30,6 @@ from . import ( narrowbundle2, narrowrepo, -narrowspec, ) table = {} diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -24,14 +24,14 @@ error, exchange, extensions, +narrowspec, repair, util, wireproto, ) from . import ( narrowrepo, -narrowspec, ) NARROWCAP = 'narrow' To: indygreg, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2201: narrowspec: move module into core
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Having support for parsing the narrow specification in core is necessary for moving many other parts of narrow to core. We do still want to harmonize the narrow spec with the sparse spec. And the format needs to be documented. But this shouldn't hold up the code moving to core. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2201 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowcommands.py hgext/narrow/narrowdirstate.py hgext/narrow/narrowrepo.py hgext/narrow/narrowspec.py hgext/narrow/narrowwirepeer.py mercurial/narrowspec.py tests/test-narrow-expanddirstate.t CHANGE DETAILS diff --git a/tests/test-narrow-expanddirstate.t b/tests/test-narrow-expanddirstate.t --- a/tests/test-narrow-expanddirstate.t +++ b/tests/test-narrow-expanddirstate.t @@ -51,22 +51,22 @@ > from mercurial import extensions > from mercurial import localrepo > from mercurial import match as matchmod + > from mercurial import narrowspec > from mercurial import patch > from mercurial import util as hgutil > > def expandnarrowspec(ui, repo, newincludes=None): > if not newincludes: > return > import sys > newincludes = set([newincludes]) - > narrowhg = extensions.find('narrow') > includes, excludes = repo.narrowpats - > currentmatcher = narrowhg.narrowspec.match(repo.root, includes, excludes) + > currentmatcher = narrowspec.match(repo.root, includes, excludes) > includes = includes | newincludes > if not repo.currenttransaction(): > ui.develwarn('expandnarrowspec called outside of transaction!') > repo.setnarrowpats(includes, excludes) - > newmatcher = narrowhg.narrowspec.match(repo.root, includes, excludes) + > newmatcher = narrowspec.match(repo.root, includes, excludes) > added = matchmod.differencematcher(newmatcher, currentmatcher) > for f in repo['.'].manifest().walk(added): > repo.dirstate.normallookup(f) diff --git a/hgext/narrow/narrowspec.py b/mercurial/narrowspec.py rename from hgext/narrow/narrowspec.py rename to mercurial/narrowspec.py --- a/hgext/narrow/narrowspec.py +++ b/mercurial/narrowspec.py @@ -9,8 +9,8 @@ import errno -from mercurial.i18n import _ -from mercurial import ( +from .i18n import _ +from . import ( error, hg, match as matchmod, @@ -89,7 +89,7 @@ # We use newlines as separators in the narrowspec file, so don't allow them # in patterns. if _numlines(pat) > 1: -raise error.Abort('newlines are not allowed in narrowspec paths') +raise error.Abort(_('newlines are not allowed in narrowspec paths')) components = pat.split('/') if '.' in components or '..' in components: diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -12,11 +12,10 @@ error, extensions, hg, +narrowspec, node, ) -from . import narrowspec - def uisetup(): def peersetup(ui, peer): # We must set up the expansion before reposetup below, since it's used diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -12,12 +12,12 @@ hg, localrepo, match as matchmod, +narrowspec, scmutil, ) from . import ( narrowrevlog, -narrowspec, ) # When narrowing is finalized and no longer subject to format changes, diff --git a/hgext/narrow/narrowdirstate.py b/hgext/narrow/narrowdirstate.py --- a/hgext/narrow/narrowdirstate.py +++ b/hgext/narrow/narrowdirstate.py @@ -13,11 +13,10 @@ error, extensions, match as matchmod, +narrowspec, util as hgutil, ) -from . import narrowspec - def setup(repo): """Add narrow spec dirstate ignore, block changes outside narrow spec.""" diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -18,6 +18,7 @@ extensions, hg, merge, +narrowspec, node, registrar, repair, @@ -28,7 +29,6 @@ from . import ( narrowbundle2, narrowrepo, -narrowspec, ) table = {} diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -24,14 +24,14 @@ error, exchange, extensions, +narrowspec, repair, util, wireproto, ) from . import ( narrowrepo, -narrowspec, ) NARROWCAP = 'narrow' To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel