Show More
@@ -78,22 +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 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 | def addlargefiles(ui, repo, isaddremove, matcher, **opts): |
|
81 | def addlargefiles(ui, repo, isaddremove, matcher, **opts): | |
98 | large = opts.get(r'large') |
|
82 | large = opts.get(r'large') | |
99 | lfsize = lfutil.getminsize( |
|
83 | lfsize = lfutil.getminsize( | |
@@ -756,11 +740,11 b' def overriderevert(orig, ui, repo, ctx, ' | |||||
756 |
|
740 | |||
757 | oldstandins = lfutil.getstandinsstate(repo) |
|
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 | default='relpath', badfn=None): |
|
744 | default='relpath', badfn=None): | |
761 | if opts is None: |
|
745 | if opts is None: | |
762 | opts = {} |
|
746 | opts = {} | |
763 |
match = o |
|
747 | match = orig(mctx, pats, opts, globbed, default, badfn=badfn) | |
764 | m = copy.copy(match) |
|
748 | m = copy.copy(match) | |
765 |
|
749 | |||
766 | # revert supports recursing into subrepos, and though largefiles |
|
750 | # revert supports recursing into subrepos, and though largefiles | |
@@ -791,11 +775,8 b' def overriderevert(orig, ui, repo, ctx, ' | |||||
791 | return origmatchfn(f) |
|
775 | return origmatchfn(f) | |
792 | m.matchfn = matchfn |
|
776 | m.matchfn = matchfn | |
793 | return m |
|
777 | return m | |
794 | oldmatch = installmatchfn(overridematch) |
|
778 | with extensions.wrappedfunction(scmutil, 'match', overridematch): | |
795 | try: |
|
|||
796 | orig(ui, repo, ctx, parents, *pats, **opts) |
|
779 | orig(ui, repo, ctx, parents, *pats, **opts) | |
797 | finally: |
|
|||
798 | restorematchfn() |
|
|||
799 |
|
780 | |||
800 | newstandins = lfutil.getstandinsstate(repo) |
|
781 | newstandins = lfutil.getstandinsstate(repo) | |
801 | filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) |
|
782 | filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) |
General Comments 0
You need to be logged in to leave comments.
Login now