diff --git a/hgext/narrow/TODO.rst b/hgext/narrow/TODO.rst --- a/hgext/narrow/TODO.rst +++ b/hgext/narrow/TODO.rst @@ -21,3 +21,11 @@ narrowrepo.setnarrowpats() or narrowspec.save() need to make sure they're holding the wlock. + +The follinwg places do an unrestricted dirstate walk (including files outside the +narrowspec). Some of them should perhaps not do that. + + * debugfileset + * perfwalk + * sparse (but restricted to sparse config) + * largefiles diff --git a/hgext/narrow/narrowdirstate.py b/hgext/narrow/narrowdirstate.py --- a/hgext/narrow/narrowdirstate.py +++ b/hgext/narrow/narrowdirstate.py @@ -26,13 +26,6 @@ return _wrapper class narrowdirstate(dirstate.__class__): - def walk(self, match, subrepos, unknown, ignored, full=True, - narrowonly=True): - if narrowonly: - match = repo.narrowmatch(match, includeexact=True) - return super(narrowdirstate, self).walk(match, subrepos, unknown, - ignored, full) - # Prevent adding/editing/copying/deleting files that are outside the # sparse checkout @_editfunc diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2044,6 +2044,7 @@ if abort or warn: cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate) + match = repo.narrowmatch(match, includeexact=True) badmatch = matchmod.badmatch(match, badfn) dirstate = repo.dirstate # We don't want to just call wctx.walk here, since it would return a lot of diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -1098,6 +1098,7 @@ ctx = repo[None] dirstate = repo.dirstate + matcher = repo.narrowmatch(matcher, includeexact=True) walkresults = dirstate.walk(matcher, subrepos=sorted(ctx.substate), unknown=True, ignored=False, full=False) for abs, st in walkresults.iteritems():