[PATCH 2 of 2] cmdutil: make commit message shown in text editor customizable by template

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Tue Jul 15 08:40:50 CDT 2014


At Mon, 14 Jul 2014 17:44:05 -0500,
Matt Mackall wrote:
> 
> On Tue, 2014-07-15 at 01:31 +0900, FUJIWARA Katsunori wrote:
> > # HG changeset patch
> > # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> > # Date 1405353550 -32400
> > #      Tue Jul 15 00:59:10 2014 +0900
> > # Node ID 7392ce1e88463adeafc6416f976c9589ed9eed43
> > # Parent  f5df6f7bf9a04559b31df62592244209d90e79ab
> > 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
> > 
> > In addition to pre-defined template keywords, this patch adds commit
> > log specific ones below:
> > 
> >   - subrepos:
> >       List of strings. Updated subrepositories in the changeset.
> > 
> >   - currentbookmark:
> >       String. The active bookmark associated with the changeset, if exists.
> > 
> >   - extramsg:
> >       String: Extra message instead of 'Leave message empty to abort
> >       commit.', if specified. This is specific for MQ commands, which
> >       use default message (e.g. '[mq]: PATCHNAME') if commit message
> >       is empty.
> 
> I assume you've just temporarily forgotten I reject patches with
> multiple features on principle. The first two look like they belong in
> the core templates.

Oops ! 'extramsg' made me mis-recognize generality of other two
keywords. I'll send them in separated patches.

> > For example, the editor shows as same text as one shown before this
> > patch, with the configuration below.
> > 
> >   [committemplate]
> >   changeset = {desc}\n\n
> >       HG: Enter commit message.  Lines beginning with 'HG:' are removed.
> >       HG: {if(extramsg, extramsg, "Leave message empty to abort commit.")}
> >       HG: --
> >       HG: user: {author}\n{ifeq(p2rev, "-1", "",
> >      "HG: branch merge\n")
> >      }HG: branch '{branch}'\n{if(currentbookmark,
> >      "HG: bookmark '{currentbookmark}'\n")  }{subrepos %
> >      "HG: subrepo {subrepo}\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")}
> 
> These are great docs, too bad they're in the commit message.

I'll put them into 'hg help config'

> > This patch still uses old implementation "buildcommittext" in default
> > for safety, because some problematic encodings (CP932/Shift-JIS, for
> > example) use backslash (0x5c) in multibyte character sequence, even
> > though it has special meaning also for template.
> 
> Can you be more specific?

I'll describe more detailed explanation about it.

----------------------------------------------------------------------
[FUJIWARA Katsunori]                             foozy at lares.dti.ne.jp


More information about the Mercurial-devel mailing list