Show More
@@ -412,15 +412,8 b' def listfilediffs(tmpl, files, node, max' | |||
|
412 | 412 | |
|
413 | 413 | def diffs(repo, tmpl, ctx, basectx, files, parity, style): |
|
414 | 414 | |
|
415 | def countgen(): | |
|
416 | start = 1 | |
|
417 | while True: | |
|
418 | yield start | |
|
419 | start += 1 | |
|
420 | ||
|
421 | blockcount = countgen() | |
|
422 | def prettyprintlines(diff, blockno): | |
|
423 | for lineno, l in enumerate(diff.splitlines(True), 1): | |
|
415 | def prettyprintlines(lines, blockno): | |
|
416 | for lineno, l in enumerate(lines, 1): | |
|
424 | 417 | difflineno = "%d.%d" % (blockno, lineno) |
|
425 | 418 | if l.startswith('+'): |
|
426 | 419 | ltype = "difflineplus" |
@@ -445,19 +438,16 b' def diffs(repo, tmpl, ctx, basectx, file' | |||
|
445 | 438 | node1 = basectx.node() |
|
446 | 439 | node2 = ctx.node() |
|
447 | 440 | |
|
448 | block = [] | |
|
449 | for chunk in patch.diff(repo, node1, node2, m, opts=diffopts): | |
|
450 | if chunk.startswith('diff') and block: | |
|
451 | blockno = next(blockcount) | |
|
441 | diffhunks = patch.diffhunks(repo, node1, node2, m, opts=diffopts) | |
|
442 | for blockno, (header, hunks) in enumerate(diffhunks, 1): | |
|
443 | if style != 'raw': | |
|
444 | header = header[1:] | |
|
445 | lines = [h + '\n' for h in header] | |
|
446 | for hunkrange, hunklines in hunks: | |
|
447 | lines.extend(hunklines) | |
|
448 | if lines: | |
|
452 | 449 | yield tmpl('diffblock', parity=next(parity), blockno=blockno, |
|
453 |
lines=prettyprintlines( |
|
|
454 | block = [] | |
|
455 | if chunk.startswith('diff') and style != 'raw': | |
|
456 | chunk = ''.join(chunk.splitlines(True)[1:]) | |
|
457 | block.append(chunk) | |
|
458 | blockno = next(blockcount) | |
|
459 | yield tmpl('diffblock', parity=next(parity), blockno=blockno, | |
|
460 | lines=prettyprintlines(''.join(block), blockno)) | |
|
450 | lines=prettyprintlines(lines, blockno)) | |
|
461 | 451 | |
|
462 | 452 | def compare(tmpl, context, leftlines, rightlines): |
|
463 | 453 | '''Generator function that provides side-by-side comparison data.''' |
General Comments 0
You need to be logged in to leave comments.
Login now