D594: cmdutil: remove redundant if block and fix indentation in amend

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


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

REVISION SUMMARY
  addressing the TODO in cmdutil.amend and removing the redundant if block.

TEST PLAN
  ran the test suite

REPOSITORY
  rHG Mercurial

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

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
@@ -3172,14 +3172,13 @@
         finally:
             repo.ui.setconfig('phases', 'new-commit', ph, 'amend')
 
-        # TODO: remove if block and fix indentation
-        if True:
-            # Reroute the working copy parent to the new changeset
-            repo.setparents(newid, nullid)
-            mapping = {old.node(): (newid,)}
-            if node:
-                mapping[node] = ()
-            scmutil.cleanupnodes(repo, mapping, 'amend')
+        # Reroute the working copy parent to the new changeset
+        repo.setparents(newid, nullid)
+        mapping = {old.node(): (newid,)}
+        if node:
+            mapping[node] = ()
+        scmutil.cleanupnodes(repo, mapping, 'amend')
+
     return newid
 
 def commiteditor(repo, ctx, subs, editform=''):



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


More information about the Mercurial-devel mailing list