D597: cmdutil: moving first use of newid closer to its use in amend

singhsrb (Saurabh Singh) phabricator at mercurial-scm.org
Thu Aug 31 22:01:51 EDT 2017


singhsrb created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D597

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3037,7 +3037,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
@@ -3162,6 +3161,7 @@
             return old.node()
 
         ph = repo.ui.config('phases', 'new-commit', phases.draft)
+        newid = None
         try:
             if opts.get('secret'):
                 commitphase = 'secret'



To: singhsrb, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list