diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -71,6 +71,7 @@ def composelargefilematcher(match, manif """create a matcher that matches only the largefiles in the original matcher""" m = copy.copy(match) + m._was_tampered_with = True lfile = lambda f: lfutil.standin(f) in manifest m._files = [lf for lf in m._files if lfile(lf)] m._fileset = set(m._files) @@ -86,6 +87,7 @@ def composenormalfilematcher(match, mani excluded.update(exclude) m = copy.copy(match) + m._was_tampered_with = True notlfile = lambda f: not ( lfutil.isstandin(f) or lfutil.standin(f) in manifest or f in excluded ) @@ -442,6 +444,8 @@ def overridelog(orig, ui, repo, *pats, * pats.update(fixpats(f, tostandin) for f in p) + m._was_tampered_with = True + for i in range(0, len(m._files)): # Don't add '.hglf' to m.files, since that is already covered by '.' if m._files[i] == b'.': @@ -849,6 +853,7 @@ def overridecopy(orig, ui, repo, pats, o newpats.append(pat) match = orig(ctx, newpats, opts, globbed, default, badfn=badfn) m = copy.copy(match) + m._was_tampered_with = True lfile = lambda f: lfutil.standin(f) in manifest m._files = [lfutil.standin(f) for f in m._files if lfile(f)] m._fileset = set(m._files) @@ -967,6 +972,7 @@ def overriderevert(orig, ui, repo, ctx, opts = {} match = orig(mctx, pats, opts, globbed, default, badfn=badfn) m = copy.copy(match) + m._was_tampered_with = True # revert supports recursing into subrepos, and though largefiles # currently doesn't work correctly in that case, this match is @@ -1595,6 +1601,7 @@ def scmutiladdremove( # confused state later. if s.deleted: m = copy.copy(matcher) + m._was_tampered_with = True # The m._files and m._map attributes are not changed to the deleted list # because that affects the m.exact() test, which in turn governs whether @@ -1721,6 +1728,7 @@ def overridecat(orig, ui, repo, file1, * err = 1 notbad = set() m = scmutil.match(ctx, (file1,) + pats, pycompat.byteskwargs(opts)) + m._was_tampered_with = True origmatchfn = m.matchfn def lfmatchfn(f): diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -395,9 +395,15 @@ def _donormalize(patterns, default, root class basematcher: def __init__(self, badfn=None): + self._was_tampered_with = False if badfn is not None: self.bad = badfn + def was_tampered_with(self): + # [_was_tampered_with] is used to track if when extensions changed the matcher + # behavior (crazy stuff!), so we disable the rust fast path. + return self._was_tampered_with + def __call__(self, fn): return self.matchfn(fn)