changeset 38566:1770416de208

webutil: pass a diffopts object to context.diff
author Boris Feld <boris.feld@octobus.net>
date Sat, 23 Jun 2018 14:42:58 +0200
parents 6ec996e8c9bc
children 97469c5430cd
files mercurial/hgweb/webutil.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py	Sat Jun 23 14:37:10 2018 +0200
+++ b/mercurial/hgweb/webutil.py	Sat Jun 23 14:42:58 2018 +0200
@@ -41,6 +41,7 @@
 )
 
 from ..utils import (
+    diffutil,
     stringutil,
 )
 
@@ -206,8 +207,8 @@
     return templateutil.mappinggenerator(_ctxsgen, args=(siblings,))
 
 def difffeatureopts(req, ui, section):
-    diffopts = patch.difffeatureopts(ui, untrusted=True,
-                                     section=section, whitespace=True)
+    diffopts = diffutil.difffeatureopts(ui, untrusted=True,
+                                        section=section, whitespace=True)
 
     for k in ('ignorews', 'ignorewsamount', 'ignorewseol', 'ignoreblanklines'):
         v = req.qsparams.get(k)
@@ -657,8 +658,9 @@
 def diffstatgen(ctx, basectx):
     '''Generator function that provides the diffstat data.'''
 
+    diffopts = patch.diffopts(ctx._repo.ui, {'noprefix': False})
     stats = patch.diffstatdata(
-        util.iterlines(ctx.diff(basectx, opts={'noprefix': False})))
+        util.iterlines(ctx.diff(basectx, opts=diffopts)))
     maxname, maxtotal, addtotal, removetotal, binary = patch.diffstatsum(stats)
     while True:
         yield stats, maxname, maxtotal, addtotal, removetotal, binary