##// END OF EJS Templates
commit: respect --no-edit in combination with --amend...
Kyle Lippincott -
r42591:64ed405d default
parent child Browse files
Show More
@@ -2583,12 +2583,18 b' def amend(ui, repo, old, extra, pats, op'
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()
@@ -943,17 +943,7 b' Test that amend with --no-edit avoids th'
943 (We need a file change here since we won't have a message change)
943 (We need a file change here since we won't have a message change)
944 $ cp foo foo.orig
944 $ cp foo foo.orig
945 $ echo hi >> foo
945 $ echo hi >> foo
946 FIXME: This shouldn't start the editor.
947 $ HGEDITOR=cat hg commit --amend --no-edit
946 $ HGEDITOR=cat hg commit --amend --no-edit
948 editor should be suppressed
949
950
951 HG: Enter commit message. Lines beginning with 'HG:' are removed.
952 HG: Leave message empty to abort commit.
953 HG: --
954 HG: user: test
955 HG: branch 'silliness'
956 HG: added foo
957 $ hg parents --template "{desc}\n"
947 $ hg parents --template "{desc}\n"
958 editor should be suppressed
948 editor should be suppressed
959 $ hg status -mar
949 $ hg status -mar
General Comments 0
You need to be logged in to leave comments. Login now