D4901: narrow: move remaining narrow-limited dirstate walks to core
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Fri Oct 5 22:57:30 UTC 2018
martinvonz updated this revision to Diff 11726.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D4901?vs=11725&id=11726
REVISION DETAIL
https://phab.mercurial-scm.org/D4901
AFFECTED FILES
hgext/narrow/TODO.rst
hgext/narrow/narrowdirstate.py
mercurial/cmdutil.py
mercurial/scmutil.py
CHANGE DETAILS
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():
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/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/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
To: martinvonz, durin42, #hg-reviewers
Cc: pulkit, mercurial-devel
More information about the Mercurial-devel
mailing list