comparison mercurial/localrepo.py @ 43711:7f443cce2972

commit: rewrite check for `hg ci <path>` being a directory 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. Differential Revision: https://phab.mercurial-scm.org/D7437
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 15 Nov 2019 14:41:00 -0800
parents 32048206e7be
children f965b1027fb0
comparison
equal deleted inserted replaced
43709:039fbd14d4e2 43711:7f443cce2972
2798 f = self.dirstate.normalize(f) 2798 f = self.dirstate.normalize(f)
2799 if f == b'.' or f in matched or f in wctx.substate: 2799 if f == b'.' or f in matched or f in wctx.substate:
2800 continue 2800 continue
2801 if f in status.deleted: 2801 if f in status.deleted:
2802 fail(f, _(b'file not found!')) 2802 fail(f, _(b'file not found!'))
2803 if f in vdirs: # visited directory 2803 # Is it a directory that exists or used to exist?
2804 if self.wvfs.isdir(f) or wctx.p1().hasdir(f):
2804 d = f + b'/' 2805 d = f + b'/'
2805 for mf in matched: 2806 for mf in matched:
2806 if mf.startswith(d): 2807 if mf.startswith(d):
2807 break 2808 break
2808 else: 2809 else: