[PATCH 7 of 9] export: port _exportsingle() to formatter

Yuya Nishihara yuya at tcha.org
Fri Apr 13 08:26:40 EDT 2018


On Thu, 12 Apr 2018 09:51:53 -0700, Gregory Szorc wrote:
> > +    if fm.isplain():
> > +        chunkiter = patch.diffui(repo, prev, node, match, opts=diffopts)
> > +        for chunk, label in chunkiter:
> > +            fm.plain(chunk, label=label)
> > +    else:
> > +        chunkiter = patch.diff(repo, prev, node, match, opts=diffopts)
> > +        # TODO: make it structured?
> > +        fm.data(diff=b''.join(chunkiter))
> >
> 
> A concern I have is that we'll want to keep the door open for writing the
> diff chunks in a structured manner. That would seemingly require a
> different key for the templater. But I think "diff" is fine as the key that
> means "a textual diff format recognized by most patch tools." We can
> introduce a "diffparts" (or similar) and make "diff" lazily evaluate as
> follow-ups, when needed.

Yes. Since the key "diff" is used by 'log -Tjson -p', we'll have to leave it
as a textual diff.


More information about the Mercurial-devel mailing list