Patchwork [3,of,6] backout: remove unnecessary dict copy

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

Comments

Kevin Bullock - Feb. 13, 2013, 7:47 p.m.
# HG changeset patch
# User Kevin Bullock <kbullock@ringworld.org>
# Date 1360685100 0
# Node ID 0bd924ff1d80ad01410368fe25e278b6150a6ebf
# Parent  67fff6f7f7bbe643f8cb21567d05d1533589c94d
backout: remove unnecessary dict copy

This is step 1 to remove backout's call to commands.commit. We don't use
the options again anywhere below except for backout's own purposes,
specifically choosing a merge tool, so we just write the commit options
in directly.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -467,12 +467,12 @@  def backout(ui, repo, node=None, rev=Non
             finally:
                 ui.setconfig('ui', 'forcemerge', '')
 
-        commit_opts = opts.copy()
-        if not commit_opts['message'] and not commit_opts['logfile']:
+        if not opts['message'] and not opts['logfile']:
             # we don't translate commit messages
-            commit_opts['message'] = "Backed out changeset %s" % short(node)
-            commit_opts['force_editor'] = True
-        commit(ui, repo, **commit_opts)
+            opts['message'] = "Backed out changeset %s" % short(node)
+            opts['force_editor'] = True
+        commit(ui, repo, **opts)
+
         def nice(node):
             return '%d:%s' % (repo.changelog.rev(node), short(node))
         ui.status(_('changeset %s backs out changeset %s\n') %