comparison mercurial/diffhelpers.c @ 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 f1c127df7c4f
children 2f51f4c535d2
comparison
equal deleted inserted replaced
31275:e2f141045634 31276:cd29673cebdb