##// END OF EJS Templates
largefiles: use wrappedfunction() for "normal files match" in overridecopy()...
Martin von Zweigbergk -
r41722:d9fd2f74 default
parent child Browse files
Show More
@@ -78,16 +78,6 b' def composenormalfilematcher(match, mani'
78 m.matchfn = lambda f: notlfile(f) and origmatchfn(f)
78 m.matchfn = lambda f: notlfile(f) and origmatchfn(f)
79 return m
79 return m
80
80
81 def installnormalfilesmatchfn(manifest):
82 '''installmatchfn with a matchfn that ignores all largefiles'''
83 def overridematch(ctx, pats=(), opts=None, globbed=False,
84 default='relpath', badfn=None):
85 if opts is None:
86 opts = {}
87 match = oldmatch(ctx, pats, opts, globbed, default, badfn=badfn)
88 return composenormalfilematcher(match, manifest)
89 oldmatch = installmatchfn(overridematch)
90
91 def installmatchfn(f):
81 def installmatchfn(f):
92 '''monkey patch the scmutil module with a custom match function.
82 '''monkey patch the scmutil module with a custom match function.
93 Warning: it is monkey patching the _module_ on runtime! Not thread safe!'''
83 Warning: it is monkey patching the _module_ on runtime! Not thread safe!'''
@@ -616,17 +606,22 b' def overridecopy(orig, ui, repo, pats, o'
616 # match largefiles and run it again.
606 # match largefiles and run it again.
617 nonormalfiles = False
607 nonormalfiles = False
618 nolfiles = False
608 nolfiles = False
619 installnormalfilesmatchfn(repo[None].manifest())
609 manifest = repo[None].manifest()
620 try:
610 def normalfilesmatchfn(orig, ctx, pats=(), opts=None, globbed=False,
621 result = orig(ui, repo, pats, opts, rename)
611 default='relpath', badfn=None):
622 except error.Abort as e:
612 if opts is None:
623 if pycompat.bytestr(e) != _('no files to copy'):
613 opts = {}
624 raise e
614 match = orig(ctx, pats, opts, globbed, default, badfn=badfn)
625 else:
615 return composenormalfilematcher(match, manifest)
626 nonormalfiles = True
616 with extensions.wrappedfunction(scmutil, 'match', normalfilesmatchfn):
627 result = 0
617 try:
628 finally:
618 result = orig(ui, repo, pats, opts, rename)
629 restorematchfn()
619 except error.Abort as e:
620 if pycompat.bytestr(e) != _('no files to copy'):
621 raise e
622 else:
623 nonormalfiles = True
624 result = 0
630
625
631 # The first rename can cause our current working directory to be removed.
626 # The first rename can cause our current working directory to be removed.
632 # In that case there is nothing left to copy/rename so just quit.
627 # In that case there is nothing left to copy/rename so just quit.
General Comments 0
You need to be logged in to leave comments. Login now