Patchwork [5,of,9,V2] webutil: pass a diffopts object to context.diff

login
register
mail settings
Submitter Boris Feld
Date July 5, 2018, 10:26 p.m.
Message ID <9f46ea00651a4f26ea64.1530829563@FB-lair>
Download mbox | patch
Permalink /patch/32654/
State Accepted
Headers show

Comments

Boris Feld - July 5, 2018, 10:26 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1529757778 -7200
#      Sat Jun 23 14:42:58 2018 +0200
# Node ID 9f46ea00651a4f26ea64be45f8b6d74bd9ab900b
# Parent  6ba2a6aea45c87cd5c25936fde8ebe635d0af8ed
# EXP-Topic diff-cleanup
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 9f46ea00651a
webutil: pass a diffopts object to context.diff

Patch

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -41,6 +41,7 @@  from .. import (
 )
 
 from ..utils import (
+    diffutil,
     stringutil,
 )
 
@@ -206,8 +207,8 @@  def _siblings(siblings=None, hiderev=Non
     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 compare(contextnum, leftlines, right
 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