[PATCH 09 of 10 RESEND] hgweb: start enumerate at 1 in webutil.diffs's inner function prettyprintlines
Denis Laxalde
denis at laxalde.org
Thu Mar 9 03:08:06 EST 2017
# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1488789879 -3600
# Mon Mar 06 09:44:39 2017 +0100
# Node ID 48a6d7717d8cde08abd448c392724cf8cb4b5282
# Parent c907c7574d72f9d82eb590057ecc19133920ad00
# Available At http://hg.logilab.org/users/dlaxalde/hg
# hg pull http://hg.logilab.org/users/dlaxalde/hg -r 48a6d7717d8c
# EXP-Topic diffhunks
hgweb: start enumerate at 1 in webutil.diffs's inner function prettyprintlines
diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -420,8 +420,8 @@ def diffs(repo, tmpl, ctx, basectx, file
blockcount = countgen()
def prettyprintlines(diff, blockno):
- for lineno, l in enumerate(diff.splitlines(True)):
- difflineno = "%d.%d" % (blockno, lineno + 1)
+ for lineno, l in enumerate(diff.splitlines(True), 1):
+ difflineno = "%d.%d" % (blockno, lineno)
if l.startswith('+'):
ltype = "difflineplus"
elif l.startswith('-'):
@@ -432,7 +432,7 @@ def diffs(repo, tmpl, ctx, basectx, file
ltype = "diffline"
yield tmpl(ltype,
line=l,
- lineno=lineno + 1,
+ lineno=lineno,
lineid="l%s" % difflineno,
linenumber="% 8s" % difflineno)
More information about the Mercurial-devel
mailing list