# HG changeset patch # User Ion Savin # Date 1326183499 -7200 # Node ID 2c480532f36eb64156c2c9f13332d51d7993b9d5 # Parent 4bc715f2a3561e73561c396ae70d37dbd967d9c9 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. Possible compatibility issue: no longer possible to tell from the annotate output if the file is terminated by new line or not. diff -r 4bc715f2a356 -r 2c480532f36e mercurial/commands.py --- a/mercurial/commands.py Tue Jan 10 13:48:42 2012 -0600 +++ b/mercurial/commands.py Tue Jan 10 10:18:19 2012 +0200 @@ -299,6 +299,9 @@ for p, l in zip(zip(*pieces), lines): ui.write("%s: %s" % ("".join(p), l[1])) + if lines and not lines[-1][1].endswith('\n'): + ui.write('\n') + @command('archive', [('', 'no-decode', None, _('do not pass files through decoders')), ('p', 'prefix', '', _('directory prefix for files in archive'), diff -r 4bc715f2a356 -r 2c480532f36e tests/test-annotate.t --- a/tests/test-annotate.t Tue Jan 10 13:48:42 2012 -0600 +++ b/tests/test-annotate.t Tue Jan 10 10:18:19 2012 +0200 @@ -255,6 +255,18 @@ abort: nosuchfile: no such file in rev e9e6b4fa872f [255] +annotate file without '\n' on last line + + $ printf "" > c + $ hg ci -A -m test -u nobody -d '1 0' + adding c + $ hg annotate c + $ printf "a\nb" > c + $ hg ci -m test + $ hg annotate c + [0-9]+: a (re) + [0-9]+: b (re) + Test annotate with whitespace options $ cd ..