Mercurial > hg
comparison mercurial/hgweb/webutil.py @ 31275:e2f141045634
hgweb: start enumerate at 1 in webutil.diffs's inner function prettyprintlines
author | Denis Laxalde <denis.laxalde@logilab.fr> |
---|---|
date | Mon, 06 Mar 2017 09:44:39 +0100 |
parents | abb92b3d370e |
children | cd29673cebdb |
comparison
equal
deleted
inserted
replaced
31274:a8023a64c40d | 31275:e2f141045634 |
---|---|
418 yield start | 418 yield start |
419 start += 1 | 419 start += 1 |
420 | 420 |
421 blockcount = countgen() | 421 blockcount = countgen() |
422 def prettyprintlines(diff, blockno): | 422 def prettyprintlines(diff, blockno): |
423 for lineno, l in enumerate(diff.splitlines(True)): | 423 for lineno, l in enumerate(diff.splitlines(True), 1): |
424 difflineno = "%d.%d" % (blockno, lineno + 1) | 424 difflineno = "%d.%d" % (blockno, lineno) |
425 if l.startswith('+'): | 425 if l.startswith('+'): |
426 ltype = "difflineplus" | 426 ltype = "difflineplus" |
427 elif l.startswith('-'): | 427 elif l.startswith('-'): |
428 ltype = "difflineminus" | 428 ltype = "difflineminus" |
429 elif l.startswith('@'): | 429 elif l.startswith('@'): |
430 ltype = "difflineat" | 430 ltype = "difflineat" |
431 else: | 431 else: |
432 ltype = "diffline" | 432 ltype = "diffline" |
433 yield tmpl(ltype, | 433 yield tmpl(ltype, |
434 line=l, | 434 line=l, |
435 lineno=lineno + 1, | 435 lineno=lineno, |
436 lineid="l%s" % difflineno, | 436 lineid="l%s" % difflineno, |
437 linenumber="% 8s" % difflineno) | 437 linenumber="% 8s" % difflineno) |
438 | 438 |
439 if files: | 439 if files: |
440 m = match.exact(repo.root, repo.getcwd(), files) | 440 m = match.exact(repo.root, repo.getcwd(), files) |