hgext/largefiles/overrides.py
changeset 51601 ea3343104f07
parent 50928 d718eddf01d9
equal deleted inserted replaced
51600:ee1b648e4453 51601:ea3343104f07
    69 
    69 
    70 def composelargefilematcher(match, manifest):
    70 def composelargefilematcher(match, manifest):
    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)
    77     m.always = lambda: False
    78     m.always = lambda: False
    78     origmatchfn = m.matchfn
    79     origmatchfn = m.matchfn
    84     excluded = set()
    85     excluded = set()
    85     if exclude is not None:
    86     if exclude is not None:
    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     )
    92     m._files = [lf for lf in m._files if notlfile(lf)]
    94     m._files = [lf for lf in m._files if notlfile(lf)]
    93     m._fileset = set(m._files)
    95     m._fileset = set(m._files)
   439                 if lfutil.isstandin(f):
   441                 if lfutil.isstandin(f):
   440                     return f
   442                     return f
   441                 return lfutil.standin(f)
   443                 return lfutil.standin(f)
   442 
   444 
   443         pats.update(fixpats(f, tostandin) for f in p)
   445         pats.update(fixpats(f, tostandin) for f in p)
       
   446 
       
   447         m._was_tampered_with = True
   444 
   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'.':
   448                 continue
   452                 continue
   847                     newpats.append(pat.replace(lfutil.shortname, b''))
   851                     newpats.append(pat.replace(lfutil.shortname, b''))
   848                 else:
   852                 else:
   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)
   855             origmatchfn = m.matchfn
   860             origmatchfn = m.matchfn
   856 
   861 
   965         ):
   970         ):
   966             if opts is None:
   971             if opts is None:
   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
   973             # called, so the lfdirstate above may not be the correct one for
   979             # called, so the lfdirstate above may not be the correct one for
   974             # this invocation of match.
   980             # this invocation of match.
  1593     # to have handled by original addremove.  Monkey patching here makes sure
  1599     # to have handled by original addremove.  Monkey patching here makes sure
  1594     # we don't remove the standin in the largefiles code, preventing a very
  1600     # we don't remove the standin in the largefiles code, preventing a very
  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
  1601         # or not the file name is printed, and how.  Simply limit the original
  1608         # or not the file name is printed, and how.  Simply limit the original
  1602         # matches to those in the deleted status list.
  1609         # matches to those in the deleted status list.
  1719 def overridecat(orig, ui, repo, file1, *pats, **opts):
  1726 def overridecat(orig, ui, repo, file1, *pats, **opts):
  1720     ctx = logcmdutil.revsingle(repo, opts.get('rev'))
  1727     ctx = logcmdutil.revsingle(repo, opts.get('rev'))
  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):
  1727         if origmatchfn(f):
  1735         if origmatchfn(f):
  1728             return True
  1736             return True