650 # When we call orig below it creates the standins but we don't add |
650 # When we call orig below it creates the standins but we don't add |
651 # them to the dir state until later so lock during that time. |
651 # them to the dir state until later so lock during that time. |
652 wlock = repo.wlock() |
652 wlock = repo.wlock() |
653 |
653 |
654 manifest = repo[None].manifest() |
654 manifest = repo[None].manifest() |
655 def overridematch(ctx, pats=(), opts=None, globbed=False, |
655 def overridematch(orig, ctx, pats=(), opts=None, globbed=False, |
656 default='relpath', badfn=None): |
656 default='relpath', badfn=None): |
657 if opts is None: |
657 if opts is None: |
658 opts = {} |
658 opts = {} |
659 newpats = [] |
659 newpats = [] |
660 # The patterns were previously mangled to add the standin |
660 # The patterns were previously mangled to add the standin |
662 for pat in pats: |
662 for pat in pats: |
663 if matchmod.patkind(pat) is None and lfutil.shortname in pat: |
663 if matchmod.patkind(pat) is None and lfutil.shortname in pat: |
664 newpats.append(pat.replace(lfutil.shortname, '')) |
664 newpats.append(pat.replace(lfutil.shortname, '')) |
665 else: |
665 else: |
666 newpats.append(pat) |
666 newpats.append(pat) |
667 match = oldmatch(ctx, newpats, opts, globbed, default, badfn=badfn) |
667 match = orig(ctx, newpats, opts, globbed, default, badfn=badfn) |
668 m = copy.copy(match) |
668 m = copy.copy(match) |
669 lfile = lambda f: lfutil.standin(f) in manifest |
669 lfile = lambda f: lfutil.standin(f) in manifest |
670 m._files = [lfutil.standin(f) for f in m._files if lfile(f)] |
670 m._files = [lfutil.standin(f) for f in m._files if lfile(f)] |
671 m._fileset = set(m._files) |
671 m._fileset = set(m._files) |
672 origmatchfn = m.matchfn |
672 origmatchfn = m.matchfn |
694 if not opts['force'] and os.path.exists(destlfile): |
693 if not opts['force'] and os.path.exists(destlfile): |
695 raise IOError('', |
694 raise IOError('', |
696 _('destination largefile already exists')) |
695 _('destination largefile already exists')) |
697 copiedfiles.append((src, dest)) |
696 copiedfiles.append((src, dest)) |
698 orig(src, dest, *args, **kwargs) |
697 orig(src, dest, *args, **kwargs) |
699 with extensions.wrappedfunction(util, 'copyfile', overridecopyfile): |
698 with extensions.wrappedfunction(util, 'copyfile', overridecopyfile), \ |
|
699 extensions.wrappedfunction(scmutil, 'match', overridematch): |
700 result += orig(ui, repo, listpats, opts, rename) |
700 result += orig(ui, repo, listpats, opts, rename) |
701 |
701 |
702 lfdirstate = lfutil.openlfdirstate(ui, repo) |
702 lfdirstate = lfutil.openlfdirstate(ui, repo) |
703 for (src, dest) in copiedfiles: |
703 for (src, dest) in copiedfiles: |
704 if (lfutil.shortname in src and |
704 if (lfutil.shortname in src and |