# HG changeset patch # User Saurabh Singh # Date 2017-09-01 19:34:36 # Node ID da13616d1a922831bb80d0380ac10326acbaed06 # Parent 7e9ccb1670e3069c9b6130e549981b664d546eb1 amend: moving first assignment of newid closer to its use newid was needlessly further away from where its intended to be used leading to bad readability. This commit moves it to address the same. The end goal is to remove the redundant commit in the amend code path and this commit takes care of cleaning up some unrelated code before that change. Test Plan: ran the test suite Differential Revision: https://phab.mercurial-scm.org/D597 diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -3039,7 +3039,6 @@ def amend(ui, repo, commitfunc, old, ext ui.note(_('amending changeset %s\n') % old) base = old.p1() - newid = None with repo.wlock(), repo.lock(), repo.transaction('amend'): # See if we got a message from -m or -l, if not, open the editor # with the message of the changeset to amend @@ -3164,6 +3163,7 @@ def amend(ui, repo, commitfunc, old, ext return old.node() ph = repo.ui.config('phases', 'new-commit', phases.draft) + newid = None try: if opts.get('secret'): commitphase = 'secret'