changeset 34074:da13616d1a92

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
author Saurabh Singh <singhsrb@fb.com>
date Fri, 01 Sep 2017 12:34:36 -0700
parents 7e9ccb1670e3
children 4bf1889456f3
files mercurial/cmdutil.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Thu Aug 31 18:35:39 2017 -0700
+++ b/mercurial/cmdutil.py	Fri Sep 01 12:34:36 2017 -0700
@@ -3039,7 +3039,6 @@
     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 @@
             return old.node()
 
         ph = repo.ui.config('phases', 'new-commit', phases.draft)
+        newid = None
         try:
             if opts.get('secret'):
                 commitphase = 'secret'