[PATCH 1 of 7 V3] hgweb: drop "parity" from webutil.diffs arguments
Augie Fackler
raf at durin42.com
Thu Mar 23 11:48:49 EDT 2017
On Wed, Mar 22, 2017 at 11:37:26AM +0100, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde <denis.laxalde at logilab.fr>
> # Date 1489398019 -3600
> # Mon Mar 13 10:40:19 2017 +0100
> # Node ID 2620dc84c013ab9d60d9327aa33435936bd25a01
> # Parent 527a247f114f8af37326805fd6cce923f9ac6453
> # Available At http://hg.logilab.org/users/dlaxalde/hg
> # hg pull http://hg.logilab.org/users/dlaxalde/hg -r 2620dc84c013
> # EXP-Topic linerange-log/hgweb-filelog
> hgweb: drop "parity" from webutil.diffs arguments
>From mercurial/templates/spartan/map:
diffblock = '<pre class="parity{parity}">{lines}</pre>'
So I don't think this is unused?
>
> This function yields "diffblock" templates which do not make use of "parity".
> In fact, maybe this template *should* make use of parity stripes as it would
> make /rev views more readable with the diff involves several files?
>
> diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
> --- a/mercurial/hgweb/webcommands.py
> +++ b/mercurial/hgweb/webcommands.py
> @@ -756,12 +756,11 @@ def filediff(web, req, tmpl):
> ctx = fctx.changectx()
> basectx = ctx.p1()
>
> - parity = paritygen(web.stripecount)
> style = web.config('web', 'style', 'paper')
> if 'style' in req.form:
> style = req.form['style'][0]
>
> - diffs = webutil.diffs(web.repo, tmpl, ctx, basectx, [path], parity, style)
> + diffs = webutil.diffs(web.repo, tmpl, ctx, basectx, [path], style)
> if fctx is not None:
> rename = webutil.renamelink(fctx)
> ctx = fctx
> diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
> --- a/mercurial/hgweb/webutil.py
> +++ b/mercurial/hgweb/webutil.py
> @@ -388,8 +388,7 @@ def changesetentry(web, req, tmpl, ctx):
> if 'style' in req.form:
> style = req.form['style'][0]
>
> - parity = paritygen(web.stripecount)
> - diff = diffs(web.repo, tmpl, ctx, basectx, None, parity, style)
> + diff = diffs(web.repo, tmpl, ctx, basectx, None, style)
>
> parity = paritygen(web.stripecount)
> diffstatsgen = diffstatgen(ctx, basectx)
> @@ -414,7 +413,7 @@ def listfilediffs(tmpl, files, node, max
> if len(files) > max:
> yield tmpl('fileellipses')
>
> -def diffs(repo, tmpl, ctx, basectx, files, parity, style):
> +def diffs(repo, tmpl, ctx, basectx, files, style):
>
> def prettyprintlines(lines, blockno):
> for lineno, l in enumerate(lines, 1):
> @@ -450,7 +449,7 @@ def diffs(repo, tmpl, ctx, basectx, file
> for hunkrange, hunklines in hunks:
> lines.extend(hunklines)
> if lines:
> - yield tmpl('diffblock', parity=next(parity), blockno=blockno,
> + yield tmpl('diffblock', blockno=blockno,
> lines=prettyprintlines(lines, blockno))
>
> def compare(tmpl, context, leftlines, rightlines):
> _______________________________________________
> 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