[PATCH 4 of 4] json: implement {fileannotate} template

Gregory Szorc gregory.szorc at gmail.com
Sun Apr 12 17:07:06 CDT 2015


On Sat, Apr 11, 2015 at 5:25 PM, Augie Fackler <raf at durin42.com> wrote:

> On Fri, Apr 10, 2015 at 10:40:43PM -0400, Gregory Szorc wrote:
> > # HG changeset patch
> > # User Gregory Szorc <gregory.szorc at gmail.com>
> > # Date 1428719860 14400
> > #      Fri Apr 10 22:37:40 2015 -0400
> > # Node ID caabf8dd0c2c055059be96269a4f79ea20b1e8de
> > # Parent  cb1e30a5c4f4c8ebd09afc617e160c5de0e10362
> > json: implement {fileannotate} template
> >
> > diff --git a/mercurial/templates/json/map b/mercurial/templates/json/map
> > --- a/mercurial/templates/json/map
> > +++ b/mercurial/templates/json/map
> > @@ -133,9 +133,29 @@ comparisonline = '\{
> >    "ll": {leftline|json},
> >    "rn": {rightlineno|json},
> >    "rl": {rightline|json}
> >    }'
> > -fileannotate = '"not yet implemented"'
> > +fileannotate = '\{
> > +  "abspath": {file|json},
> > +  "node": {node|json},
> > +  "author": {author|json},
> > +  "date": {date|json},
> > +  "desc": {desc|json},
> > +  "parents": [{join(parent%changesetparent, ", ")}],
> > +  "children": [{join(child%changesetparent, ", ")}],
> > +  "permissions": {permissions|json},
> > +  "annotate": [{join(annotate%fileannotation, ", ")}]
> > +  }'
> > +fileannotation = '\{
> > +  "node": {node|json},
> > +  "author": {author|json},
> > +  "desc": {desc|json},
> > +  "abspath": {file|json},
> > +  "targetline": {targetline|json},
> > +  "line": {line|json},
> > +  "lineno": {lineno|json},
>
> It seems somewhat redundant to have the line number when the lines
> already end up in a list. Is there something I'm missing?
>
> This is a small nit on an otherwise good series, so I'm going to queue
> it and we can fix it in a followup.
>
>
Yeah, it's redundant.

I could foresee someone adding a parameter to the blame API to limit what
lines are returned. At that time, line number would be required. So we
might as well throw it in to be consistent. Or we can always rip it out
since YAGNI applies and add it when necessary. I'd rather implement support
for start and end line to the web API :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150412/8070ae30/attachment.html>


More information about the Mercurial-devel mailing list