D4901: narrow: move remaining narrow-limited dirstate walks to core

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sat Oct 6 01:08:48 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG1d09ba0d2ed3: narrow: move remaining narrow-limited dirstate walks to core (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4901?vs=11726&id=11739

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
@@ -14,3 +14,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