Mercurial > public > mercurial-scm > hg-stable
diff tests/test-mq-qrefresh-replace-log-message.t @ 21924:5375ba75df40
cmdutil: make commit message shown in text editor customizable by template
This patch makes commit message shown in text editor customizable by
template. For example, this can advertise:
- sample commit messages for routine works,
- points to call attention before commit,
- message of the day, and so on
To show commit message correctly even in problematic encoding, this
patch chooses the latter below:
- replace "buildcommittext" with "buildcommittemplate" completely
- invoke "buildcommittemplate" only if '[committemplate] changeset'
is configured explicitly
For example, if multibyte character ending with backslash (0x5c) is
followed by ASCII character 'n' in the customized template, sequence
of backslash and 'n' is treated as line-feed unexpectedly (and
multibyte character is broken, too).
This corruption occurs in 'decode("string-escape")' while parsing
template string.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Tue, 15 Jul 2014 23:34:13 +0900 |
parents | 7a51bced398b |
children | a5168eb9b2bc |
line wrap: on
line diff
--- a/tests/test-mq-qrefresh-replace-log-message.t Fri Jul 18 23:15:28 2014 -0500 +++ b/tests/test-mq-qrefresh-replace-log-message.t Tue Jul 15 23:34:13 2014 +0900 @@ -26,10 +26,28 @@ First commit message Testing changing message with -m -(this tests also that '--edit' can be used with '--message') +(this tests also that '--edit' can be used with '--message', and +that '[committemplate] changeset' definition and commit log specific +template keyword 'extramsg' work well) + + $ cat >> .hg/hgrc <<EOF + > [committemplate] + > changeset = HG: this is customized commit template + > {desc}\n\n + > HG: Enter commit message. Lines beginning with 'HG:' are removed. + > HG: {extramsg} + > HG: -- + > HG: user: {author} + > HG: branch '{branch}'\n{file_adds % + > "HG: added {file}\n" }{file_mods % + > "HG: changed {file}\n" }{file_dels % + > "HG: removed {file}\n" }{if(files, "", + > "HG: no files changed\n")} + > EOF $ echo bbbb > file $ HGEDITOR=cat hg qrefresh -m "Second commit message" -e + HG: this is customized commit template Second commit message @@ -40,6 +58,12 @@ HG: branch 'default' HG: added file + $ cat >> .hg/hgrc <<EOF + > # disable customizing for subsequent tests + > [committemplate] + > changeset = + > EOF + Should display 'Second commit message' $ hg log -l1 --template "{desc}\n"