[PATCH 2 of 5] formatter: add fm.nested(field) to either write or build sub items

Yuya Nishihara yuya at tcha.org
Tue Aug 23 09:36:07 EDT 2016


On Mon, 22 Aug 2016 08:54:02 -0700, Gregory Szorc wrote:
> > On Aug 22, 2016, at 07:44, Yuya Nishihara <yuya at tcha.org> wrote:
> > # HG changeset patch
> > # User Yuya Nishihara <yuya at tcha.org>
> > # Date 1457866779 -32400
> > #      Sun Mar 13 19:59:39 2016 +0900
> > # Node ID 22b19113435d7e2d0dd0eb8a515d131f2552b8ac
> > # Parent  194ac3287b843cad7bf3d21f4f17ac901b070dea
> > formatter: add fm.nested(field) to either write or build sub items
> > 
> > We sometimes need to build nested items by formatter, but there was no
> > convenient way other than building and putting them manually by fm.data():
> 
> If there is always a begin and end call, should we be using a context manager?

baseformatter could have __enter__ and __exit__, but I'm not tempted to use
"with" statement there because doing that would add extra indent.


More information about the Mercurial-devel mailing list