[PATCH 1 of 6] backout: use cmdutil.revert directly instead of commands.revert

Kevin Bullock kbullock+mercurial at ringworld.org
Wed Feb 13 13:47:43 CST 2013


# HG changeset patch
# User Kevin Bullock <kbullock at ringworld.org>
# Date 1360681637 0
# Node ID a6300d15b1e82121a9b646126ba35809068f340e
# Parent  1506eb487dddbc377398096ce797fa5ccd712f10
backout: use cmdutil.revert directly instead of commands.revert

Before this change, backout would explicitly set the options it passed
to commands.revert in order to fall thru most of its logic and call
cmdutil.revert. This change makes it clearer what backup is trying to
accomplish and makes it robust against changes to the revert command.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -458,12 +458,8 @@ def backout(ui, repo, node=None, rev=Non
         branch = repo.dirstate.branch()
         hg.clean(repo, node, show_stats=False)
         repo.dirstate.setbranch(branch)
-        revert_opts = opts.copy()
-        revert_opts['date'] = None
-        revert_opts['all'] = True
-        revert_opts['rev'] = hex(parent)
-        revert_opts['no_backup'] = None
-        revert(ui, repo, **revert_opts)
+        rctx = scmutil.revsingle(repo, hex(parent))
+        cmdutil.revert(ui, repo, rctx, repo.dirstate.parents())
         if not opts.get('merge') and op1 != node:
             try:
                 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))


More information about the Mercurial-devel mailing list