comparison mercurial/cmdutil.py @ 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 6e6452bc441d
children 7e9ccb1670e3
comparison
equal deleted inserted replaced
34071:3c82b14d2838 34072:ae92e5c0441c
3171 commitphase = old.phase() 3171 commitphase = old.phase()
3172 repo.ui.setconfig('phases', 'new-commit', commitphase, 'amend') 3172 repo.ui.setconfig('phases', 'new-commit', commitphase, 'amend')
3173 newid = repo.commitctx(new) 3173 newid = repo.commitctx(new)
3174 finally: 3174 finally:
3175 repo.ui.setconfig('phases', 'new-commit', ph, 'amend') 3175 repo.ui.setconfig('phases', 'new-commit', ph, 'amend')
3176 if newid != old.node(): 3176
3177 # Reroute the working copy parent to the new changeset 3177 # Reroute the working copy parent to the new changeset
3178 repo.setparents(newid, nullid) 3178 repo.setparents(newid, nullid)
3179 mapping = {old.node(): (newid,)} 3179 mapping = {old.node(): (newid,)}
3180 if node: 3180 if node:
3181 mapping[node] = () 3181 mapping[node] = ()
3182 scmutil.cleanupnodes(repo, mapping, 'amend') 3182 scmutil.cleanupnodes(repo, mapping, 'amend')
3183
3183 return newid 3184 return newid
3184 3185
3185 def commiteditor(repo, ctx, subs, editform=''): 3186 def commiteditor(repo, ctx, subs, editform=''):
3186 if ctx.description(): 3187 if ctx.description():
3187 return ctx.description() 3188 return ctx.description()