[PATCH] annotate: append newline after non newline-terminated file listings

Matt Mackall mpm at selenic.com
Tue Jan 10 11:46:26 CST 2012


On Tue, 2012-01-10 at 09:30 +0100, Ion Savin wrote:
> > On Mon, 2012-01-09 at 00:27 +0200, Ion Savin wrote:
> > > # HG changeset patch
> > > # User Ion Savin <comp_ at gmx.net>
> > > # Date 1326061171 -7200
> > > # Node ID afadfd2e74bf5325aa115710c728f425e6b9cd96
> > > # Parent  f15c646bffc7187c357f3dcc12761513c1ed6609
> > > annotate: append newline after non newline-terminated file listings
> > > 
> > > The last line of a non newline-terminated file would mix with the first 
> > > line of
> > > the next file in multiple-file listings before this patch.
> > 
> > 
> > > +            if not lines[-1][1].endswith('\n'):
> > > +                ui.write('\n')
> > 
> > I bet this breaks if there are zero lines.
> 
> It shouldn't break as the condition is evaluated only when "pieces" is
> not-empty and this is non-empty when "lines" is non-empty. Hope I'm
> not missing something.
> 
> Resending with empty file testcase (which passes for the previous
> patch also) and a more robust condition.
> 
> # HG changeset patch
> # User Ion Savin <ion.savin at tora.com>
> # Date 1326183499 -7200
> # Node ID 77e105251e224468999c45506fb25d3999fcd61d
> # Parent  94a4748db392c2bd03b05db64151fe7bea8bd102
> annotate: append newline after non newline-terminated file listings

Queued for default, thanks.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list