##// END OF EJS Templates
revert: remove dangerous `parents` argument from `cmdutil.revert()`...
Martin von Zweigbergk -
r45935:8c466bcb default
parent child Browse files
Show More
@@ -635,12 +635,11 b' def commitfuncfor(repo, src):'
635
635
636 def applychanges(ui, repo, ctx, opts):
636 def applychanges(ui, repo, ctx, opts):
637 """Merge changeset from ctx (only) in the current working directory"""
637 """Merge changeset from ctx (only) in the current working directory"""
638 wcpar = repo.dirstate.p1()
638 if ctx.p1().node() == repo.dirstate.p1():
639 if ctx.p1().node() == wcpar:
640 # edits are "in place" we do not need to make any merge,
639 # edits are "in place" we do not need to make any merge,
641 # just applies changes on parent for editing
640 # just applies changes on parent for editing
642 ui.pushbuffer()
641 ui.pushbuffer()
643 cmdutil.revert(ui, repo, ctx, (wcpar, node.nullid), all=True)
642 cmdutil.revert(ui, repo, ctx, all=True)
644 stats = mergemod.updateresult(0, 0, 0, 0)
643 stats = mergemod.updateresult(0, 0, 0, 0)
645 ui.popbuffer()
644 ui.popbuffer()
646 else:
645 else:
@@ -874,7 +874,7 b' def overridecopy(orig, ui, repo, pats, o'
874 # the matcher to hit standins instead of largefiles. Based on the
874 # the matcher to hit standins instead of largefiles. Based on the
875 # resulting standins update the largefiles.
875 # resulting standins update the largefiles.
876 @eh.wrapfunction(cmdutil, b'revert')
876 @eh.wrapfunction(cmdutil, b'revert')
877 def overriderevert(orig, ui, repo, ctx, parents, *pats, **opts):
877 def overriderevert(orig, ui, repo, ctx, *pats, **opts):
878 # Because we put the standins in a bad state (by updating them)
878 # Because we put the standins in a bad state (by updating them)
879 # and then return them to a correct state we need to lock to
879 # and then return them to a correct state we need to lock to
880 # prevent others from changing them in their incorrect state.
880 # prevent others from changing them in their incorrect state.
@@ -937,7 +937,7 b' def overriderevert(orig, ui, repo, ctx, '
937 return m
937 return m
938
938
939 with extensions.wrappedfunction(scmutil, b'match', overridematch):
939 with extensions.wrappedfunction(scmutil, b'match', overridematch):
940 orig(ui, repo, ctx, parents, *pats, **opts)
940 orig(ui, repo, ctx, *pats, **opts)
941
941
942 newstandins = lfutil.getstandinsstate(repo)
942 newstandins = lfutil.getstandinsstate(repo)
943 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
943 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
@@ -1717,11 +1717,7 b' class queue(object):'
1717 except: # re-raises
1717 except: # re-raises
1718 self.ui.warn(_(b'cleaning up working directory...\n'))
1718 self.ui.warn(_(b'cleaning up working directory...\n'))
1719 cmdutil.revert(
1719 cmdutil.revert(
1720 self.ui,
1720 self.ui, repo, repo[b'.'], no_backup=True,
1721 repo,
1722 repo[b'.'],
1723 repo.dirstate.parents(),
1724 no_backup=True,
1725 )
1721 )
1726 # only remove unknown files that we know we touched or
1722 # only remove unknown files that we know we touched or
1727 # created while patching
1723 # created while patching
@@ -3493,9 +3493,9 b' def postcommitstatus(repo, pats, opts):'
3493 return repo.status(match=scmutil.match(repo[None], pats, opts))
3493 return repo.status(match=scmutil.match(repo[None], pats, opts))
3494
3494
3495
3495
3496 def revert(ui, repo, ctx, parents, *pats, **opts):
3496 def revert(ui, repo, ctx, *pats, **opts):
3497 opts = pycompat.byteskwargs(opts)
3497 opts = pycompat.byteskwargs(opts)
3498 parent, p2 = parents
3498 parent, p2 = repo.dirstate.parents()
3499 node = ctx.node()
3499 node = ctx.node()
3500
3500
3501 mf = ctx.manifest()
3501 mf = ctx.manifest()
@@ -3781,7 +3781,6 b' def revert(ui, repo, ctx, parents, *pats'
3781 match = scmutil.match(repo[None], pats)
3781 match = scmutil.match(repo[None], pats)
3782 _performrevert(
3782 _performrevert(
3783 repo,
3783 repo,
3784 parents,
3785 ctx,
3784 ctx,
3786 names,
3785 names,
3787 uipathfn,
3786 uipathfn,
@@ -3807,7 +3806,6 b' def revert(ui, repo, ctx, parents, *pats'
3807
3806
3808 def _performrevert(
3807 def _performrevert(
3809 repo,
3808 repo,
3810 parents,
3811 ctx,
3809 ctx,
3812 names,
3810 names,
3813 uipathfn,
3811 uipathfn,
@@ -3823,7 +3821,7 b' def _performrevert('
3823
3821
3824 Make sure you have the working directory locked when calling this function.
3822 Make sure you have the working directory locked when calling this function.
3825 """
3823 """
3826 parent, p2 = parents
3824 parent, p2 = repo.dirstate.parents()
3827 node = ctx.node()
3825 node = ctx.node()
3828 excluded_files = []
3826 excluded_files = []
3829
3827
@@ -837,7 +837,7 b' def _dobackout(ui, repo, node=None, rev='
837 else:
837 else:
838 hg.clean(repo, node, show_stats=False)
838 hg.clean(repo, node, show_stats=False)
839 repo.dirstate.setbranch(branch)
839 repo.dirstate.setbranch(branch)
840 cmdutil.revert(ui, repo, rctx, repo.dirstate.parents())
840 cmdutil.revert(ui, repo, rctx)
841
841
842 if opts.get(b'no_commit'):
842 if opts.get(b'no_commit'):
843 msg = _(b"changeset %s backed out, don't forget to commit.\n")
843 msg = _(b"changeset %s backed out, don't forget to commit.\n")
@@ -6301,9 +6301,7 b' def revert(ui, repo, *pats, **opts):'
6301 hint = _(b"use --all to revert all files")
6301 hint = _(b"use --all to revert all files")
6302 raise error.Abort(msg, hint=hint)
6302 raise error.Abort(msg, hint=hint)
6303
6303
6304 return cmdutil.revert(
6304 return cmdutil.revert(ui, repo, ctx, *pats, **pycompat.strkwargs(opts))
6305 ui, repo, ctx, (parent, p2), *pats, **pycompat.strkwargs(opts)
6306 )
6307
6305
6308
6306
6309 @command(
6307 @command(
@@ -772,7 +772,7 b' def mergefiles(ui, repo, wctx, shelvectx'
772 with ui.configoverride({(b'ui', b'quiet'): True}):
772 with ui.configoverride({(b'ui', b'quiet'): True}):
773 hg.update(repo, wctx.node())
773 hg.update(repo, wctx.node())
774 ui.pushbuffer(True)
774 ui.pushbuffer(True)
775 cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents())
775 cmdutil.revert(ui, repo, shelvectx)
776 ui.popbuffer()
776 ui.popbuffer()
777
777
778
778
@@ -986,12 +986,11 b' class hgsubrepo(abstractsubrepo):'
986
986
987 def filerevert(self, *pats, **opts):
987 def filerevert(self, *pats, **opts):
988 ctx = self._repo[opts['rev']]
988 ctx = self._repo[opts['rev']]
989 parents = self._repo.dirstate.parents()
990 if opts.get('all'):
989 if opts.get('all'):
991 pats = [b'set:modified()']
990 pats = [b'set:modified()']
992 else:
991 else:
993 pats = []
992 pats = []
994 cmdutil.revert(self.ui, self._repo, ctx, parents, *pats, **opts)
993 cmdutil.revert(self.ui, self._repo, ctx, *pats, **opts)
995
994
996 def shortid(self, revid):
995 def shortid(self, revid):
997 return revid[:12]
996 return revid[:12]
General Comments 0
You need to be logged in to leave comments. Login now