Mercurial > public > mercurial-scm > hg-stable
diff mercurial/patch.py @ 31283:92714858dd3e
mdiff: let unidiff return (diffheader, hunks)
This will be used to make it possible to filter diff hunks based on this range
information.
Now unidiff returns a 'hunks' generator that yield tuple (hunkrange,
hunklines) coming from _unidiff() with 'newline at end of file' processing.
author | Denis Laxalde <denis.laxalde@logilab.fr> |
---|---|
date | Fri, 03 Mar 2017 17:46:40 +0100 |
parents | b3861be6aa6c |
children | a8023a64c40d |
line wrap: on
line diff
--- a/mercurial/patch.py Fri Mar 03 17:46:28 2017 +0100 +++ b/mercurial/patch.py Fri Mar 03 17:46:40 2017 +0100 @@ -2549,10 +2549,11 @@ gitindex(content2)[0:opts.index], gitmode[flag])) - uheaders, text = mdiff.unidiff(content1, date1, - content2, date2, - path1, path2, opts=opts) + uheaders, hunks = mdiff.unidiff(content1, date1, + content2, date2, + path1, path2, opts=opts) header.extend(uheaders) + text = ''.join(sum((list(hlines) for hrange, hlines in hunks), [])) if header and (text or len(header) > 1): yield '\n'.join(header) + '\n' if text: