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

login
register
mail settings
Submitter Kevin Bullock
Date Feb. 13, 2013, 7:47 p.m.
Message ID <a6300d15b1e82121a9b6.1360784863@x-128-101-230-141.uofm-secure.wireless.umn.edu>
Download mbox | patch
Permalink /patch/980/
State Accepted
Commit fafdff7e9c438bf9397476115a44faf6c7100865
Headers show

Comments

Kevin Bullock - Feb. 13, 2013, 7:47 p.m.
# HG changeset patch
# User Kevin Bullock <kbullock@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.

Patch

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', ''))