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

Yuya Nishihara yuya at tcha.org
Sat Oct 14 05:58:33 UTC 2017


On Fri, 13 Oct 2017 20:00:32 +0200, Boris Feld wrote:
> 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.

map-cmdline.default is not, but defaulttempl is. You need to %include a
map file to share some bits.

> 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?

Maybe we can add {verbosity} keyword which returns ''/quiet/verbose/debug.



More information about the Mercurial-devel mailing list