Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Thu May 30 14:14:52 2019 -0700 +++ b/mercurial/cmdutil.py Thu May 30 13:57:34 2019 -0700 @@ -2583,12 +2583,18 @@ message = logmessage(ui, opts) editform = mergeeditform(old, 'commit.amend') - editor = getcommiteditor(editform=editform, - **pycompat.strkwargs(opts)) if not message: - editor = getcommiteditor(edit=True, editform=editform) message = old.description() + # Default if message isn't provided and --edit is not passed is to + # invoke editor, but allow --no-edit. If somehow we don't have any + # description, let's always start the editor. + doedit = not message or opts.get('edit') in [True, None] + else: + # Default if message is provided is to not invoke editor, but allow + # --edit. + doedit = opts.get('edit') is True + editor = getcommiteditor(edit=doedit, editform=editform) pureextra = extra.copy() extra['amend_source'] = old.hex()