Mercurial > hg
changeset 21418:d4b8fc753455
tag: use the editor gotten by "getcommiteditor()" instead of "ui.edit()"
This patch also enhances "test-tag.t", because "hg tag" hasn't been
explicitly tested around editor invocation and "--edit" option.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sun, 11 May 2014 00:49:36 +0900 |
parents | 308aaeb956e2 |
children | 272785489ed3 |
files | mercurial/commands.py tests/test-tag.t |
diffstat | 2 files changed, 34 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Sun May 11 00:49:36 2014 +0900 +++ b/mercurial/commands.py Sun May 11 00:49:36 2014 +0900 @@ -5695,11 +5695,7 @@ if date: date = util.parsedate(date) - if opts.get('edit'): - def editor(repo, ctx, subs): - return ui.edit(ctx.description() + "\n", ctx.user()) - else: - editor = False + editor = cmdutil.getcommiteditor(**opts) # don't allow tagging the null rev if (not opts.get('remove') and
--- a/tests/test-tag.t Sun May 11 00:49:36 2014 +0900 +++ b/tests/test-tag.t Sun May 11 00:49:36 2014 +0900 @@ -16,7 +16,10 @@ abort: tag names cannot consist entirely of whitespace [255] - $ hg tag "bleah" +(this tests also that editor is not invoked, if '--edit' is not +specified) + + $ HGEDITOR=cat hg tag "bleah" $ hg history changeset: 1:d4f0d2909abc tag: tip @@ -219,6 +222,9 @@ test custom commit messages $ cat > editor.sh << '__EOF__' + > echo "==== before editing" + > cat "$1" + > echo "====" > echo "custom tag message" > "$1" > echo "second line" >> "$1" > __EOF__ @@ -250,8 +256,22 @@ > pretxncommit.unexpectedabort = false > __EOF__ +(this tests also that editor is invoked, if '--edit' is specified, +regardless of '--message') + $ rm -f .hg/last-message.txt - $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e + $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e -m "foo bar" + ==== before editing + foo bar + + + HG: Enter commit message. Lines beginning with 'HG:' are removed. + HG: Leave message empty to abort commit. + HG: -- + HG: user: test + HG: branch 'tag-and-branch-same-name' + HG: changed .hgtags + ==== transaction abort! rollback completed note: commit message saved in .hg/last-message.txt @@ -272,6 +292,17 @@ then, test custom commit message itself $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e + ==== before editing + Added tag custom-tag for changeset 75a534207be6 + + + HG: Enter commit message. Lines beginning with 'HG:' are removed. + HG: Leave message empty to abort commit. + HG: -- + HG: user: test + HG: branch 'tag-and-branch-same-name' + HG: changed .hgtags + ==== $ hg log -l1 --template "{desc}\n" custom tag message second line