comparison mercurial/cmdutil.py @ 42418:64ed405dd342

commit: respect --no-edit in combination with --amend Differential Revision: https://phab.mercurial-scm.org/D6464
author Kyle Lippincott <spectral@google.com>
date Thu, 30 May 2019 13:57:34 -0700
parents 19b95afb0c01
children 307f67d4aee3
comparison
equal deleted inserted replaced
42417:060ff3396589 42418:64ed405dd342
2581 # See if we got a message from -m or -l, if not, open the editor with 2581 # See if we got a message from -m or -l, if not, open the editor with
2582 # the message of the changeset to amend. 2582 # the message of the changeset to amend.
2583 message = logmessage(ui, opts) 2583 message = logmessage(ui, opts)
2584 2584
2585 editform = mergeeditform(old, 'commit.amend') 2585 editform = mergeeditform(old, 'commit.amend')
2586 editor = getcommiteditor(editform=editform,
2587 **pycompat.strkwargs(opts))
2588 2586
2589 if not message: 2587 if not message:
2590 editor = getcommiteditor(edit=True, editform=editform)
2591 message = old.description() 2588 message = old.description()
2589 # Default if message isn't provided and --edit is not passed is to
2590 # invoke editor, but allow --no-edit. If somehow we don't have any
2591 # description, let's always start the editor.
2592 doedit = not message or opts.get('edit') in [True, None]
2593 else:
2594 # Default if message is provided is to not invoke editor, but allow
2595 # --edit.
2596 doedit = opts.get('edit') is True
2597 editor = getcommiteditor(edit=doedit, editform=editform)
2592 2598
2593 pureextra = extra.copy() 2599 pureextra = extra.copy()
2594 extra['amend_source'] = old.hex() 2600 extra['amend_source'] = old.hex()
2595 2601
2596 new = context.memctx(repo, 2602 new = context.memctx(repo,