Mercurial > hg
diff mercurial/lsprofcalltree.py @ 31276:cd29673cebdb
hgweb: use patch.diffhunks in webutil.diffs to simplify the algorithm
Function patch.diffhunks yields items for a "block" (i.e. a file) as a whole
so take advantage of this to simplify the algorithm and avoid parsing diff
lines to determine whether we're starting a new "block" or not. Thus we drop
to external block counter and rely on diffhunks iterations instead.
We also take advantage of the fact that patch.diffhunks() yields *lines* of
hunks (instead of a string) to avoid building a list that is ''.join-ed into a
string that is then split.
As lines in 'header' returned by patch.diffhunks() have no trailing new line,
we need to insert it ourselves to match template expectations.
author | Denis Laxalde <denis.laxalde@logilab.fr> |
---|---|
date | Mon, 06 Mar 2017 09:28:33 +0100 |
parents | 5a988b3c9645 |
children | 1ae0faa14797 |