diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3394,6 +3394,9 @@ def tag(ui, repo, name1, *names, **opts) if date: date = util.parsedate(date) + if opts.get('edit'): + message = ui.edit(message, ui.username()) + repo.tag(names, r, message, opts.get('local'), opts.get('user'), date) def tags(ui, repo): @@ -4038,6 +4041,7 @@ table = { ('r', 'rev', '', _('revision to tag')), ('', 'remove', None, _('remove a tag')), # -l/--local is already there, commitopts cannot be used + ('e', 'edit', None, _('edit commit message')), ('m', 'message', '', _('use as commit message')), ] + commitopts2, _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...')), diff --git a/tests/test-debugcomplete.out b/tests/test-debugcomplete.out --- a/tests/test-debugcomplete.out +++ b/tests/test-debugcomplete.out @@ -223,7 +223,7 @@ revert: all, date, rev, no-backup, inclu rollback: dry-run root: showconfig: untrusted -tag: force, local, rev, remove, message, date, user +tag: force, local, rev, remove, edit, message, date, user tags: tip: patch, git, style, template unbundle: update diff --git a/tests/test-tag b/tests/test-tag --- a/tests/test-tag +++ b/tests/test-tag @@ -73,3 +73,13 @@ echo % tag and branch using same name hg branch tag-and-branch-same-name hg ci -m"discouraged" hg tag tag-and-branch-same-name + +echo '% test custom commit messages' +cat > $HGTMP/editor <<'__EOF__' +#!/bin/sh +echo "custom tag message" > "$1" +echo "second line" >> "$1" +__EOF__ +chmod +x "$HGTMP"/editor +HGEDITOR="'$HGTMP'"/editor hg tag custom-tag -e +hg log -l1 --template "{desc}\n" diff --git a/tests/test-tag.out b/tests/test-tag.out --- a/tests/test-tag.out +++ b/tests/test-tag.out @@ -97,3 +97,6 @@ 6ae703d793c8b1f097116869275ecd97b2977a2b % tag and branch using same name marked working directory as branch tag-and-branch-same-name warning: tag tag-and-branch-same-name conflicts with existing branch name +% test custom commit messages +custom tag message +second line