[PATCH 1 of 1] tag: add -e/--edit option for modifying the commit message
Steve Losh
steve at stevelosh.com
Sat May 15 22:33:57 CDT 2010
# HG changeset patch
# User Steve Losh <steve at stevelosh.com>
# Date 1273980802 14400
# Node ID 41ce35a18a05009cc65276b659dda60ef30a75d3
# Parent 39e7f14a828666c2ca2e4560b4a41896a7692326
tag: add -e/--edit option for modifying the commit message
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3279,20 +3279,23 @@
if not message:
# we don't translate commit messages
message = ('Added tag %s for changeset %s' %
(', '.join(names), short(r)))
date = opts.get('date')
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):
"""list repository tags
This lists both regular and local tags. When the -v/--verbose
switch is used, a third column "local" is printed for local tags.
"""
hexfunc = ui.debugflag and hex or short
@@ -3913,20 +3916,21 @@
('', 'change', '', _('list the changed files of a revision')),
] + walkopts,
_('[OPTION]... [FILE]...')),
"tag":
(tag,
[('f', 'force', None, _('replace existing tag')),
('l', 'local', None, _('make the tag local')),
('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...')),
"tags": (tags, [], ''),
"tip":
(tip,
[('p', 'patch', None, _('show patch')),
('g', 'git', None, _('use git extended diff format')),
] + templateopts,
_('[-p] [-g]')),
diff --git a/tests/test-debugcomplete.out b/tests/test-debugcomplete.out
--- a/tests/test-debugcomplete.out
+++ b/tests/test-debugcomplete.out
@@ -216,16 +216,16 @@
outgoing: force, rev, newest-first, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd
parents: rev, style, template
paths:
recover:
rename: after, force, include, exclude, dry-run
resolve: all, list, mark, unmark, no-status, include, exclude
revert: all, date, rev, no-backup, include, exclude, dry-run
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
verify:
version:
diff --git a/tests/test-tag b/tests/test-tag
--- a/tests/test-tag
+++ b/tests/test-tag
@@ -66,10 +66,20 @@
EOF
hg ci -d '1000000 0' -m'broken manual edit of .hgtags'
cat .hgtags
hg tag -d '1000000 0' newline
cat .hgtags
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
@@ -90,10 +90,13 @@
Removed tag gack, gorp
% issue 601
3ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah13ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah1
f68b039e72eacbb2e68b0543e1f6e50990aa2bb5 localnewline
0acdaf8983679e0aac16e811534eb49d7ee1f2b4 foobar0acdaf8983679e0aac16e811534eb49d7ee1f2b4 foobar
6ae703d793c8b1f097116869275ecd97b2977a2b newline
% 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
More information about the Mercurial-devel
mailing list