changeset 38565:64f15e22f4f8

template: directly instantiate diff options for diffstat
author Boris Feld <boris.feld@octobus.net>
date Sat, 23 Jun 2018 14:30:31 +0200
parents b9724978633e
children 6ec996e8c9bc
files mercurial/templatekw.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templatekw.py	Sat Jun 23 13:26:23 2018 +0100
+++ b/mercurial/templatekw.py	Sat Jun 23 14:30:31 2018 +0200
@@ -27,6 +27,7 @@
     util,
 )
 from .utils import (
+    diffutil,
     stringutil,
 )
 
@@ -263,7 +264,8 @@
     "modified files: +added/-removed lines"
     """
     ctx = context.resource(mapping, 'ctx')
-    diff = ctx.diff(opts={'noprefix': False})
+    diffopts = diffutil.diffopts(ctx._repo.ui, {'noprefix': False})
+    diff = ctx.diff(opts=diffopts)
     stats = patch.diffstatdata(util.iterlines(diff))
     maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
     return '%d: +%d/-%d' % (len(stats), adds, removes)