Show More
@@ -78,22 +78,6 b' def composenormalfilematcher(match, mani' | |||
|
78 | 78 | m.matchfn = lambda f: notlfile(f) and origmatchfn(f) |
|
79 | 79 | return m |
|
80 | 80 | |
|
81 | def installmatchfn(f): | |
|
82 | '''monkey patch the scmutil module with a custom match function. | |
|
83 | Warning: it is monkey patching the _module_ on runtime! Not thread safe!''' | |
|
84 | oldmatch = scmutil.match | |
|
85 | setattr(f, 'oldmatch', oldmatch) | |
|
86 | scmutil.match = f | |
|
87 | return oldmatch | |
|
88 | ||
|
89 | def restorematchfn(): | |
|
90 | '''restores scmutil.match to what it was before installmatchfn | |
|
91 | was called. no-op if scmutil.match is its original function. | |
|
92 | ||
|
93 | Note that n calls to installmatchfn will require n calls to | |
|
94 | restore the original matchfn.''' | |
|
95 | scmutil.match = getattr(scmutil.match, 'oldmatch') | |
|
96 | ||
|
97 | 81 | def addlargefiles(ui, repo, isaddremove, matcher, **opts): |
|
98 | 82 | large = opts.get(r'large') |
|
99 | 83 | lfsize = lfutil.getminsize( |
@@ -756,11 +740,11 b' def overriderevert(orig, ui, repo, ctx, ' | |||
|
756 | 740 | |
|
757 | 741 | oldstandins = lfutil.getstandinsstate(repo) |
|
758 | 742 | |
|
759 | def overridematch(mctx, pats=(), opts=None, globbed=False, | |
|
743 | def overridematch(orig, mctx, pats=(), opts=None, globbed=False, | |
|
760 | 744 | default='relpath', badfn=None): |
|
761 | 745 | if opts is None: |
|
762 | 746 | opts = {} |
|
763 |
match = o |
|
|
747 | match = orig(mctx, pats, opts, globbed, default, badfn=badfn) | |
|
764 | 748 | m = copy.copy(match) |
|
765 | 749 | |
|
766 | 750 | # revert supports recursing into subrepos, and though largefiles |
@@ -791,11 +775,8 b' def overriderevert(orig, ui, repo, ctx, ' | |||
|
791 | 775 | return origmatchfn(f) |
|
792 | 776 | m.matchfn = matchfn |
|
793 | 777 | return m |
|
794 | oldmatch = installmatchfn(overridematch) | |
|
795 | try: | |
|
778 | with extensions.wrappedfunction(scmutil, 'match', overridematch): | |
|
796 | 779 | orig(ui, repo, ctx, parents, *pats, **opts) |
|
797 | finally: | |
|
798 | restorematchfn() | |
|
799 | 780 | |
|
800 | 781 | newstandins = lfutil.getstandinsstate(repo) |
|
801 | 782 | filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) |
General Comments 0
You need to be logged in to leave comments.
Login now