diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1324,6 +1324,8 @@ def clone(ui, source, dest=None, **opts) _('mark a branch as closed, hiding it from the branch list')), ('', 'amend', None, _('amend the parent of the working dir')), ('s', 'secret', None, _('use the secret phase for committing')), + ('e', 'edit', None, + _('further edit commit message already specified')), ] + walkopts + commitopts + commitopts2 + subrepoopts, _('[OPTION]... [FILE]...')) def commit(ui, repo, *pats, **opts): @@ -1362,6 +1364,8 @@ def commit(ui, repo, *pats, **opts): Returns 0 on success, 1 if nothing changed. """ + forceeditor = opts.get('force_editor') or opts.get('edit') + if opts.get('subrepos'): if opts.get('amend'): raise util.Abort(_('cannot amend with --subrepos')) @@ -1400,7 +1404,7 @@ def commit(ui, repo, *pats, **opts): raise util.Abort(_('cannot amend changeset with children')) e = cmdutil.commiteditor - if opts.get('force_editor'): + if forceeditor: e = cmdutil.commitforceeditor # commitfunc is used only for temporary amend commit by cmdutil.amend @@ -1435,7 +1439,7 @@ def commit(ui, repo, *pats, **opts): newmarks.write() else: e = cmdutil.commiteditor - if opts.get('force_editor'): + if forceeditor: e = cmdutil.commitforceeditor def commitfunc(ui, repo, message, match, opts): diff --git a/tests/test-commit.t b/tests/test-commit.t --- a/tests/test-commit.t +++ b/tests/test-commit.t @@ -120,7 +120,18 @@ partial subdir commit test $ hg add adding bar/bar (glob) adding foo/foo (glob) - $ hg ci -m commit-subdir-1 foo + $ HGEDITOR=cat hg ci -e -m commit-subdir-1 foo + commit-subdir-1 + + + HG: Enter commit message. Lines beginning with 'HG:' are removed. + HG: Leave message empty to abort commit. + HG: -- + HG: user: test + HG: branch 'default' + HG: added foo/foo + + $ hg ci -m commit-subdir-2 bar subdir log 1 @@ -174,11 +185,23 @@ full log dot and subdir commit test $ hg init test3 + $ echo commit-foo-subdir > commit-log-test $ cd test3 $ mkdir foo $ echo foo content > foo/plain-file $ hg add foo/plain-file - $ hg ci -m commit-foo-subdir foo + $ HGEDITOR=cat hg ci --edit -l ../commit-log-test foo + commit-foo-subdir + + + HG: Enter commit message. Lines beginning with 'HG:' are removed. + HG: Leave message empty to abort commit. + HG: -- + HG: user: test + HG: branch 'default' + HG: added foo/plain-file + + $ echo modified foo content > foo/plain-file $ hg ci -m commit-foo-dot . diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -199,7 +199,7 @@ Show all commands + options add: include, exclude, subrepos, dry-run annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, ignore-all-space, ignore-space-change, ignore-blank-lines, include, exclude clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure - commit: addremove, close-branch, amend, secret, include, exclude, message, logfile, date, user, subrepos + commit: addremove, close-branch, amend, secret, edit, include, exclude, message, logfile, date, user, subrepos diff: rev, change, text, git, nodates, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, include, exclude, subrepos export: output, switch-parent, rev, text, git, nodates forget: include, exclude diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t --- a/tests/test-qrecord.t +++ b/tests/test-qrecord.t @@ -62,6 +62,7 @@ help record (record) list --amend amend the parent of the working dir -s --secret use the secret phase for committing + -e --edit further edit commit message already specified -I --include PATTERN [+] include names matching the given patterns -X --exclude PATTERN [+] exclude names matching the given patterns -m --message TEXT use text as commit message