##// END OF EJS Templates
largefiles: override cmdutil.revert() instead of comands.revert()...
Martin von Zweigbergk -
r24436:66a69da9 default
parent child Browse files
Show More
@@ -734,7 +734,7 b' def overridecopy(orig, ui, repo, pats, o'
734 # commits. Update the standins then run the original revert, changing
734 # commits. Update the standins then run the original revert, changing
735 # the matcher to hit standins instead of largefiles. Based on the
735 # the matcher to hit standins instead of largefiles. Based on the
736 # resulting standins update the largefiles.
736 # resulting standins update the largefiles.
737 def overriderevert(orig, ui, repo, *pats, **opts):
737 def overriderevert(orig, ui, repo, ctx, parents, *pats, **opts):
738 # Because we put the standins in a bad state (by updating them)
738 # Because we put the standins in a bad state (by updating them)
739 # and then return them to a correct state we need to lock to
739 # and then return them to a correct state we need to lock to
740 # prevent others from changing them in their incorrect state.
740 # prevent others from changing them in their incorrect state.
@@ -751,19 +751,20 b' def overriderevert(orig, ui, repo, *pats'
751
751
752 oldstandins = lfutil.getstandinsstate(repo)
752 oldstandins = lfutil.getstandinsstate(repo)
753
753
754 def overridematch(ctx, pats=[], opts={}, globbed=False,
754 def overridematch(mctx, pats=[], opts={}, globbed=False,
755 default='relpath'):
755 default='relpath'):
756 match = oldmatch(ctx, pats, opts, globbed, default)
756 match = oldmatch(mctx, pats, opts, globbed, default)
757 m = copy.copy(match)
757 m = copy.copy(match)
758
758
759 # revert supports recursing into subrepos, and though largefiles
759 # revert supports recursing into subrepos, and though largefiles
760 # currently doesn't work correctly in that case, this match is
760 # currently doesn't work correctly in that case, this match is
761 # called, so the lfdirstate above may not be the correct one for
761 # called, so the lfdirstate above may not be the correct one for
762 # this invocation of match.
762 # this invocation of match.
763 lfdirstate = lfutil.openlfdirstate(ctx.repo().ui, ctx.repo(), False)
763 lfdirstate = lfutil.openlfdirstate(mctx.repo().ui, mctx.repo(),
764 False)
764
765
765 def tostandin(f):
766 def tostandin(f):
766 if lfutil.standin(f) in ctx:
767 if lfutil.standin(f) in mctx:
767 return lfutil.standin(f)
768 return lfutil.standin(f)
768 elif lfutil.standin(f) in repo[None] or lfdirstate[f] == 'r':
769 elif lfutil.standin(f) in repo[None] or lfdirstate[f] == 'r':
769 return None
770 return None
@@ -775,13 +776,13 b' def overriderevert(orig, ui, repo, *pats'
775 def matchfn(f):
776 def matchfn(f):
776 if lfutil.isstandin(f):
777 if lfutil.isstandin(f):
777 return (origmatchfn(lfutil.splitstandin(f)) and
778 return (origmatchfn(lfutil.splitstandin(f)) and
778 (f in repo[None] or f in ctx))
779 (f in repo[None] or f in mctx))
779 return origmatchfn(f)
780 return origmatchfn(f)
780 m.matchfn = matchfn
781 m.matchfn = matchfn
781 return m
782 return m
782 oldmatch = installmatchfn(overridematch)
783 oldmatch = installmatchfn(overridematch)
783 try:
784 try:
784 orig(ui, repo, *pats, **opts)
785 orig(ui, repo, ctx, parents, *pats, **opts)
785 finally:
786 finally:
786 restorematchfn()
787 restorematchfn()
787
788
@@ -113,11 +113,7 b' def uisetup(ui):'
113 entry = extensions.wrapfunction(subrepo.hgsubrepo, 'dirty',
113 entry = extensions.wrapfunction(subrepo.hgsubrepo, 'dirty',
114 overrides.overridedirty)
114 overrides.overridedirty)
115
115
116 # Backout calls revert so we need to override both the command and the
116 entry = extensions.wrapfunction(cmdutil, 'revert',
117 # function
118 entry = extensions.wrapcommand(commands.table, 'revert',
119 overrides.overriderevert)
120 entry = extensions.wrapfunction(commands, 'revert',
121 overrides.overriderevert)
117 overrides.overriderevert)
122
118
123 extensions.wrapfunction(archival, 'archive', overrides.overridearchive)
119 extensions.wrapfunction(archival, 'archive', overrides.overridearchive)
General Comments 0
You need to be logged in to leave comments. Login now