[PATCH 05 of 11 V2] templatekw: introduce obsfate keyword

Boris Feld boris.feld at octobus.net
Fri Oct 13 14:00:32 EDT 2017


On Thu, 2017-10-12 at 22:51 +0900, Yuya Nishihara wrote:
> On Thu, 12 Oct 2017 15:29:31 +0200, Boris Feld wrote:
> > On Wed, 2017-10-11 at 22:24 +0900, Yuya Nishihara wrote:
> > > Ugh, there's templatekw.defaulttempl which provides the default
> > > template
> > > fragments to all stock/user templates. Maybe we can (ab)use it to
> > > define
> > > the default '{obsfate}' template.
> > > 
> > > I'm so sorry I didn't mention it before. It totally slipped my
> > > mind.
> > 
> > I saw templatekw.defaulttempl when working in this series but it
> > felt
> > like a big hack.
> > 
> > I tried to limit the number of places where obsfate is defined,
> > this
> > series already adds two obsfate definitions/implementations, the
> > changeset_printer and lobsfate in the default mapfile. I thought
> > adding
> > a third one in defaulttempl would complicate the potential update
> > of
> > obsfate output format.
> > 
> > I'm not an expert in the template engine, what benefits do you see
> > in
> > putting the obsfate definition in templatekw.defaulttempl?
> 
> That's more close to the end goal, right? We started off with a
> couple of
> building blocks to define {obsfate} in user template, because we
> don't want
> a monolithic {obsfate} keyword.
> 
> It would be nice if we could add "obsfate" to map-cmdline.default,
> which
> is the right way to define log templates, but IIRC you said you also
> wanted
> to reuse it in any user templates. So using defaulttempl seemed less
> bad.

I thought that keywords defined in map-cmdline.default were not
available in user-defined templates, I need to check that.

One thing that I would like is for the default obsfate templatekw to be
verbosity dependent, both in changing the fields that are shown (no
date except in verbose mode) and the content of the fields themselves
(if current user is the only one that touched a changeset and not in
verbose mode, don't show users).

Is it possible to have this verbosity dependent logic with templates?


More information about the Mercurial-devel mailing list