##// END OF EJS Templates
largefiles: track if a matcher was tampered with...
Arseniy Alekseyev -
r52494:ea334310 default
parent child Browse files
Show More
@@ -71,6 +71,7 b' def composelargefilematcher(match, manif'
71 """create a matcher that matches only the largefiles in the original
71 """create a matcher that matches only the largefiles in the original
72 matcher"""
72 matcher"""
73 m = copy.copy(match)
73 m = copy.copy(match)
74 m._was_tampered_with = True
74 lfile = lambda f: lfutil.standin(f) in manifest
75 lfile = lambda f: lfutil.standin(f) in manifest
75 m._files = [lf for lf in m._files if lfile(lf)]
76 m._files = [lf for lf in m._files if lfile(lf)]
76 m._fileset = set(m._files)
77 m._fileset = set(m._files)
@@ -86,6 +87,7 b' def composenormalfilematcher(match, mani'
86 excluded.update(exclude)
87 excluded.update(exclude)
87
88
88 m = copy.copy(match)
89 m = copy.copy(match)
90 m._was_tampered_with = True
89 notlfile = lambda f: not (
91 notlfile = lambda f: not (
90 lfutil.isstandin(f) or lfutil.standin(f) in manifest or f in excluded
92 lfutil.isstandin(f) or lfutil.standin(f) in manifest or f in excluded
91 )
93 )
@@ -442,6 +444,8 b' def overridelog(orig, ui, repo, *pats, *'
442
444
443 pats.update(fixpats(f, tostandin) for f in p)
445 pats.update(fixpats(f, tostandin) for f in p)
444
446
447 m._was_tampered_with = True
448
445 for i in range(0, len(m._files)):
449 for i in range(0, len(m._files)):
446 # Don't add '.hglf' to m.files, since that is already covered by '.'
450 # Don't add '.hglf' to m.files, since that is already covered by '.'
447 if m._files[i] == b'.':
451 if m._files[i] == b'.':
@@ -849,6 +853,7 b' def overridecopy(orig, ui, repo, pats, o'
849 newpats.append(pat)
853 newpats.append(pat)
850 match = orig(ctx, newpats, opts, globbed, default, badfn=badfn)
854 match = orig(ctx, newpats, opts, globbed, default, badfn=badfn)
851 m = copy.copy(match)
855 m = copy.copy(match)
856 m._was_tampered_with = True
852 lfile = lambda f: lfutil.standin(f) in manifest
857 lfile = lambda f: lfutil.standin(f) in manifest
853 m._files = [lfutil.standin(f) for f in m._files if lfile(f)]
858 m._files = [lfutil.standin(f) for f in m._files if lfile(f)]
854 m._fileset = set(m._files)
859 m._fileset = set(m._files)
@@ -967,6 +972,7 b' def overriderevert(orig, ui, repo, ctx, '
967 opts = {}
972 opts = {}
968 match = orig(mctx, pats, opts, globbed, default, badfn=badfn)
973 match = orig(mctx, pats, opts, globbed, default, badfn=badfn)
969 m = copy.copy(match)
974 m = copy.copy(match)
975 m._was_tampered_with = True
970
976
971 # revert supports recursing into subrepos, and though largefiles
977 # revert supports recursing into subrepos, and though largefiles
972 # currently doesn't work correctly in that case, this match is
978 # currently doesn't work correctly in that case, this match is
@@ -1595,6 +1601,7 b' def scmutiladdremove('
1595 # confused state later.
1601 # confused state later.
1596 if s.deleted:
1602 if s.deleted:
1597 m = copy.copy(matcher)
1603 m = copy.copy(matcher)
1604 m._was_tampered_with = True
1598
1605
1599 # The m._files and m._map attributes are not changed to the deleted list
1606 # The m._files and m._map attributes are not changed to the deleted list
1600 # because that affects the m.exact() test, which in turn governs whether
1607 # because that affects the m.exact() test, which in turn governs whether
@@ -1721,6 +1728,7 b' def overridecat(orig, ui, repo, file1, *'
1721 err = 1
1728 err = 1
1722 notbad = set()
1729 notbad = set()
1723 m = scmutil.match(ctx, (file1,) + pats, pycompat.byteskwargs(opts))
1730 m = scmutil.match(ctx, (file1,) + pats, pycompat.byteskwargs(opts))
1731 m._was_tampered_with = True
1724 origmatchfn = m.matchfn
1732 origmatchfn = m.matchfn
1725
1733
1726 def lfmatchfn(f):
1734 def lfmatchfn(f):
@@ -395,9 +395,15 b' def _donormalize(patterns, default, root'
395
395
396 class basematcher:
396 class basematcher:
397 def __init__(self, badfn=None):
397 def __init__(self, badfn=None):
398 self._was_tampered_with = False
398 if badfn is not None:
399 if badfn is not None:
399 self.bad = badfn
400 self.bad = badfn
400
401
402 def was_tampered_with(self):
403 # [_was_tampered_with] is used to track if when extensions changed the matcher
404 # behavior (crazy stuff!), so we disable the rust fast path.
405 return self._was_tampered_with
406
401 def __call__(self, fn):
407 def __call__(self, fn):
402 return self.matchfn(fn)
408 return self.matchfn(fn)
403
409
General Comments 0
You need to be logged in to leave comments. Login now