From patchwork Fri Sep 1 22:15:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D593: cmdutil: removing redundant if condition in amend From: phabricator X-Patchwork-Id: 23609 Message-Id: <2b5e934f3742f5907fea004f0c6456c7@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Fri, 1 Sep 2017 22:15:27 +0000 singhsrb updated this revision to Diff 1561. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D593?vs=1525&id=1561 REVISION DETAIL https://phab.mercurial-scm.org/D593 AFFECTED FILES mercurial/cmdutil.py CHANGE DETAILS To: singhsrb, #hg-reviewers Cc: durham, mercurial-devel diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -3171,13 +3171,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=''):