tag: add -e/--edit option for modifying the commit message
authorSteve Losh <steve@stevelosh.com>
Sat, 15 May 2010 23:33:22 -0400
changeset 11185 6d7cf82453be
parent 11184 7d99edddbaea
child 11186 a890cc501501
tag: add -e/--edit option for modifying the commit message
mercurial/commands.py
tests/test-debugcomplete.out
tests/test-tag
tests/test-tag.out
--- a/mercurial/commands.py	Thu Jan 07 22:19:05 2010 -0600
+++ b/mercurial/commands.py	Sat May 15 23:33:22 2010 -0400
@@ -3394,6 +3394,9 @@
     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 @@
           ('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 <text> as commit message')),
          ] + commitopts2,
          _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...')),
--- a/tests/test-debugcomplete.out	Thu Jan 07 22:19:05 2010 -0600
+++ b/tests/test-debugcomplete.out	Sat May 15 23:33:22 2010 -0400
@@ -223,7 +223,7 @@
 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
--- a/tests/test-tag	Thu Jan 07 22:19:05 2010 -0600
+++ b/tests/test-tag	Sat May 15 23:33:22 2010 -0400
@@ -73,3 +73,13 @@
 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"
--- a/tests/test-tag.out	Thu Jan 07 22:19:05 2010 -0600
+++ b/tests/test-tag.out	Sat May 15 23:33:22 2010 -0400
@@ -97,3 +97,6 @@
 % 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