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

login
register
mail settings
Submitter phabricator
Date Nov. 16, 2019, 12:34 a.m.
Message ID <differential-rev-PHID-DREV-priuwq7sojs2ulnwlgyb-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43289/
State Superseded
Headers show

Comments

phabricator - Nov. 16, 2019, 12:34 a.m.
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




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

Patch

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):