D593: cmdutil: removing redundant if condition 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
  There is needless checking for the new commit hash not being equal to
  the old commit hash. This condition will always be true at this point in the
  code path and thus, can be removed safely. This commit removes the redundant
  condition.

TEST PLAN
  ran the test suite.

REPOSITORY
  rHG Mercurial

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

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
@@ -3171,7 +3171,9 @@
             newid = repo.commitctx(new)
         finally:
             repo.ui.setconfig('phases', 'new-commit', ph, 'amend')
-        if newid != old.node():
+
+        # 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,)}



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


More information about the Mercurial-devel mailing list