D7437: commit: rewrite check for `hg ci <path>` being a directory

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sat Nov 16 00:34:51 UTC 2019


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The matcher API is complicated by match.bad, match.explicitdir, and
  match.traversedir. We already have very few users of
  match.explicitdir. By rewriting this check we get close to being able
  to remove match.explicitdir.
  
  This may make the check slower, but I think that will be very
  marginal.
  
  Disclosure: I actually wrote this patch to solve a bug we've seen with
  an internal extension. The internal extension overrides the dirstate
  walk to only walk the files that our FUSE tells us are modified. That
  led to "vdirs" not getting populated as this code expected. I have
  wanted to get rid of match.explicitdir for a very long time, though.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7437

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2800,7 +2800,8 @@
                     continue
                 if f in status.deleted:
                     fail(f, _(b'file not found!'))
-                if f in vdirs:  # visited directory
+                # Is it a directory that exists or used to exist?
+                if self.wvfs.isdir(f) or wctx.p1().hasdir(f):
                     d = f + b'/'
                     for mf in matched:
                         if mf.startswith(d):



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list