@@ -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)
rename from hgext/narrow/narrowspec.py
rename to 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:
@@ -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
@@ -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,
@@ -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."""
@@ -18,6 +18,7 @@
extensions,
hg,
merge,
+ narrowspec,
node,
registrar,
repair,
@@ -28,7 +29,6 @@
from . import (
narrowbundle2,
narrowrepo,
- narrowspec,
)
table = {}
@@ -24,14 +24,14 @@
error,
exchange,
extensions,
+ narrowspec,
repair,
util,
wireproto,
)
from . import (
narrowrepo,
- narrowspec,
)
NARROWCAP = 'narrow'