changeset 34072:ae92e5c0441c

amend: removing redundant if condition 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. Differential Revision: https://phab.mercurial-scm.org/D594
author Saurabh Singh <singhsrb@fb.com>
date Fri, 01 Sep 2017 15:08:54 -0700
parents 3c82b14d2838
children 7e9ccb1670e3
files mercurial/cmdutil.py
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Fri Sep 01 20:28:26 2017 +0000
+++ b/mercurial/cmdutil.py	Fri Sep 01 15:08:54 2017 -0700
@@ -3173,13 +3173,14 @@
             newid = repo.commitctx(new)
         finally:
             repo.ui.setconfig('phases', 'new-commit', ph, 'amend')
-        if newid != old.node():
-            # 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=''):