Mercurial > public > mercurial-scm > hg
diff hgext/graphlog.py @ 17120:01d847e0fdc9
graphlog: don't truncate template value at last \n
Most uses of templates requires a trailing newline to get vertical output.
Graphlog with a template without trailing newline did however not just create
horisontal output like other commands would but truncated the output at the
last \n. Template values without any \n were ignored completely.
Graphlog will now only eat one trailing newline before it lets the flow of the
graph add the necessary vertical space.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Fri, 06 Jul 2012 00:30:18 +0200 |
parents | 2e13c1bd34dc |
children | 868c256cb51b |
line wrap: on
line diff
--- a/hgext/graphlog.py Wed Jul 04 17:29:49 2012 +0200 +++ b/hgext/graphlog.py Fri Jul 06 00:30:18 2012 +0200 @@ -471,7 +471,9 @@ if filematcher is not None: revmatchfn = filematcher(ctx.rev()) displayer.show(ctx, copies=copies, matchfn=revmatchfn) - lines = displayer.hunk.pop(rev).split('\n')[:-1] + lines = displayer.hunk.pop(rev).split('\n') + if not lines[-1]: + del lines[-1] displayer.flush(rev) edges = edgefn(type, char, lines, seen, rev, parents) for type, char, lines, coldata in edges: