Patchwork [4,of,7] hgweb: pass ui to diffstatgen() explicitly

login
register
mail settings
Submitter Yuya Nishihara
Date July 6, 2018, 1:03 p.m.
Message ID <71f6aea244c46ba63b40.1530882229@mimosa>
Download mbox | patch
Permalink /patch/32666/
State New
Headers show

Comments

Yuya Nishihara - July 6, 2018, 1:03 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1530880547 -32400
#      Fri Jul 06 21:35:47 2018 +0900
# Node ID 71f6aea244c46ba63b404ffe2d9c651da7d7e6a1
# Parent  75f22f0f24a95921b0e4d8fce53a990f144a0b7b
hgweb: pass ui to diffstatgen() explicitly

Patch

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -509,7 +509,7 @@  def changesetentry(web, ctx):
     diff = diffs(web, ctx, basectx, None, style)
 
     parity = paritygen(web.stripecount)
-    diffstatsgen = diffstatgen(ctx, basectx)
+    diffstatsgen = diffstatgen(web.repo.ui, ctx, basectx)
     diffstats = diffstat(ctx, diffstatsgen, parity)
 
     return dict(
@@ -655,10 +655,10 @@  def compare(contextnum, leftlines, right
     return templateutil.mappinggenerator(_comparegen, args=args,
                                          name='comparisonblock')
 
-def diffstatgen(ctx, basectx):
+def diffstatgen(ui, ctx, basectx):
     '''Generator function that provides the diffstat data.'''
 
-    diffopts = patch.diffopts(ctx._repo.ui, {'noprefix': False})
+    diffopts = patch.diffopts(ui, {'noprefix': False})
     stats = patch.diffstatdata(
         util.iterlines(ctx.diff(basectx, opts=diffopts)))
     maxname, maxtotal, addtotal, removetotal, binary = patch.diffstatsum(stats)