[PATCH 09 of 10 RESEND] hgweb: start enumerate at 1 in webutil.diffs's inner function prettyprintlines

Augie Fackler raf at durin42.com
Thu Mar 9 18:55:17 EST 2017


On Thu, Mar 09, 2017 at 09:08:06AM +0100, Denis Laxalde wrote:
> # 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

I've taken patches 1-9. Looking at patch 10 soon, but I suspect I'll
want others to lay eyes on it as well. Thanks!

>
> 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)
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list