Commit Graph

8 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
28e199eab5 cmdutil: use '[committemplate]' section like as map file for style definition
Before this patch, each template definitions for 'changeset*' in
'[committemplate]' section have to be written fully from scratch,
even though many parts of them may be common.

This patch uses '[committemplate]' section like as the map file for
the style definition. All items other than 'changeset' can be referred
from others.

This can reduce total cost of template customization in
 '[committemplate]' section.

When the commit template other than '[committemplate] changeset'
is chosen by 'editform', putting '[committemplate] changeset'
value into the cache of the templater causes unexpected result,
because the templater stores the specified (= chosen) template
definition into own cache as 'changeset' at construction time.

This is the reason why '[committemplate] changeset' can't be referred
from others.
2014-08-02 21:46:27 +09:00
Danek Duvall
151b68d8da tests: cat error messages are different on Solaris 2014-07-21 11:27:24 -07:00
FUJIWARA Katsunori
f9743bb802 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.
2014-07-15 23:34:13 +09:00
FUJIWARA Katsunori
872d5bce44 qrefresh: allow to specify '--message/'--logfile' and '--edit' at the same time
Before this patch, 'hg qrefresh' disallows to specify
'--message/'--logfile' and '--edit' at the same time.

'hg qrefresh' has disallowed such combination since Mercurial 0.9.2,
but this restriction seems not to be reasonable for recent Mercurial,
because all other commands creating new changeset allow it.

This patch allows 'hg qrefresh' to specify '--message/'--logfile' and
'--edit' at the same time like other commands creating new changeset.
2014-06-01 00:08:32 +09:00
FUJIWARA Katsunori
9af54bf260 mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
This patch also replaces "editor = False" by "editor =
cmdutil.getcommiteditor()", because:

  - it allows to hook commit message determination easily, even in the
    case without "--edit"

  - it avoids regression (or additional care) around saving
    "last-message.txt", even if MQ's "newcommit()" changes its
    implementation logic from "localrepository.commit" to
    "localrepository.commitctx" with "memctx" in the future

    to save commit message into "last-messge.txt" with "memctx",
    "editor" should be valid function.
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
8430e60754 qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
Before this patch, "hg qrefresh" and "hg qfold" invoke "ui.edit()"
explicitly to get commit message edited manually.

This requires explicit "localrepository.savecommitmessage()"
invocation to save edited commit message into ".hg/last-message.txt",
because unexpected exception raising may abort command execution
before saving it in "localrepository.commit()".

This patch uses "editor" argument of "localrepository.commit()"
instead of explicit "ui.edit()" invocation for "hg qnew" and "hg qfold"

"localrepository.commit()" will invoke "desceditor()" function newly
added by this patch, and save edited commit message into
".hg/last-message.txt" automatically.

This patch passes not "editor" but "desceditor" to "commit()", because
"hg qnew" and "hg qfold" require editor function to return edited
message (and invoke "patchheader.setmessage()" with it) if not empty,
or default message otherwise.

This patch also avoids "not q.applied" check at "hg qrefresh --edit",
because it is also checked in "queue.refresh()", and it is not needed
to get commit message from patch header before "queue.refresh()".
2014-05-05 21:26:40 +09:00
timeless@mozdev.org
190d12df54 spelling: Environment 2012-08-17 13:58:18 -07:00
Matt Mackall
f54c1c0030 tests: unify test-mq-qrefresh-replace-log-message 2010-09-26 13:43:21 -05:00