diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -963,7 +963,7 @@ def overridearchive(orig, repo, dest, no if subrepos: for subpath in sorted(ctx.substate): sub = ctx.workingsub(subpath) - submatch = match_.narrowmatcher(subpath, matchfn) + submatch = match_.subdirmatcher(subpath, matchfn) sub._repo.lfstatus = True sub.archive(archiver, prefix, submatch) @@ -1011,7 +1011,7 @@ def hgsubrepoarchive(orig, repo, archive for subpath in sorted(ctx.substate): sub = ctx.workingsub(subpath) - submatch = match_.narrowmatcher(subpath, match) + submatch = match_.subdirmatcher(subpath, match) sub._repo.lfstatus = True sub.archive(archiver, prefix + repo._path + '/', submatch) diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -331,7 +331,7 @@ def archive(repo, dest, node, kind, deco if subrepos: for subpath in sorted(ctx.substate): sub = ctx.workingsub(subpath) - submatch = matchmod.narrowmatcher(subpath, matchfn) + submatch = matchmod.subdirmatcher(subpath, matchfn) total += sub.archive(archiver, prefix, submatch) if total == 0: diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1142,7 +1142,7 @@ def diffordiffstat(ui, repo, diffopts, n # node2 (inclusive). Thus, ctx2's substate won't contain that # subpath. The best we can do is to ignore it. tempnode2 = None - submatch = matchmod.narrowmatcher(subpath, match) + submatch = matchmod.subdirmatcher(subpath, match) sub.diff(ui, diffopts, tempnode2, submatch, changes=changes, stat=stat, fp=fp, prefix=prefix) @@ -2254,7 +2254,7 @@ def add(ui, repo, match, prefix, explici for subpath in sorted(wctx.substate): sub = wctx.sub(subpath) try: - submatch = matchmod.narrowmatcher(subpath, match) + submatch = matchmod.subdirmatcher(subpath, match) if opts.get('subrepos'): bad.extend(sub.add(ui, submatch, prefix, False, **opts)) else: @@ -2283,7 +2283,7 @@ def forget(ui, repo, match, prefix, expl for subpath in sorted(wctx.substate): sub = wctx.sub(subpath) try: - submatch = matchmod.narrowmatcher(subpath, match) + submatch = matchmod.subdirmatcher(subpath, match) subbad, subforgot = sub.forget(submatch, prefix) bad.extend([subpath + '/' + f for f in subbad]) forgot.extend([subpath + '/' + f for f in subforgot]) @@ -2340,7 +2340,7 @@ def files(ui, ctx, m, fm, fmt, subrepos) if subrepos or matchessubrepo(subpath): sub = ctx.sub(subpath) try: - submatch = matchmod.narrowmatcher(subpath, m) + submatch = matchmod.subdirmatcher(subpath, m) if sub.printfiles(ui, submatch, fm, fmt, subrepos) == 0: ret = 0 except error.LookupError: @@ -2369,7 +2369,7 @@ def remove(ui, repo, m, prefix, after, f if subrepos or matchessubrepo(m, subpath): sub = wctx.sub(subpath) try: - submatch = matchmod.narrowmatcher(subpath, m) + submatch = matchmod.subdirmatcher(subpath, m) if sub.removefiles(submatch, prefix, after, force, subrepos): ret = 1 except error.LookupError: @@ -2467,7 +2467,7 @@ def cat(ui, repo, ctx, matcher, prefix, for subpath in sorted(ctx.substate): sub = ctx.sub(subpath) try: - submatch = matchmod.narrowmatcher(subpath, matcher) + submatch = matchmod.subdirmatcher(subpath, matcher) if not sub.cat(submatch, os.path.join(prefix, sub._path), **opts): diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -365,7 +365,7 @@ class basectx(object): # node1 and node2 (inclusive). Thus, ctx2's substate # won't contain that subpath. The best we can do ignore it. rev2 = None - submatch = matchmod.narrowmatcher(subpath, match) + submatch = matchmod.subdirmatcher(subpath, match) s = sub.status(rev2, match=submatch, ignored=listignored, clean=listclean, unknown=listunknown, listsubrepos=True) diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -334,13 +334,13 @@ def badmatch(match, badfn): m.bad = badfn return m -class narrowmatcher(match): +class subdirmatcher(match): """Adapt a matcher to work on a subdirectory only. The paths are remapped to remove/insert the path as needed: >>> m1 = match('root', '', ['a.txt', 'sub/b.txt']) - >>> m2 = narrowmatcher('sub', m1) + >>> m2 = subdirmatcher('sub', m1) >>> bool(m2('a.txt')) False >>> bool(m2('b.txt')) diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -913,7 +913,7 @@ def addremove(repo, matcher, prefix, opt if opts.get('subrepos') or matchessubrepo(m, subpath): sub = wctx.sub(subpath) try: - submatch = matchmod.narrowmatcher(subpath, m) + submatch = matchmod.subdirmatcher(subpath, m) if sub.addremove(submatch, prefix, opts, dry_run, similarity): ret = 1 except error.LookupError: diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -774,7 +774,7 @@ class hgsubrepo(abstractsubrepo): ctx = self._repo[rev] for subpath in ctx.substate: s = subrepo(ctx, subpath, True) - submatch = matchmod.narrowmatcher(subpath, match) + submatch = matchmod.subdirmatcher(subpath, match) total += s.archive(archiver, prefix + self._path + '/', submatch) return total