Patchwork [06,of,12,V2] template: directly instantiate diff options for diffstat

login
register
mail settings
Submitter Boris Feld
Date July 3, 2018, 10:32 a.m.
Message ID <de55d9d098b8166d5826.1530613945@FB-lair>
Download mbox | patch
Permalink /patch/32572/
State Accepted
Headers show

Comments

Boris Feld - July 3, 2018, 10:32 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1529757031 -7200
#      Sat Jun 23 14:30:31 2018 +0200
# Node ID de55d9d098b8166d5826a2c77c5c34c1f94672c9
# Parent  0d2b1cf8cd7ecf81984253ac1e5142f35a53eaa6
# EXP-Topic diff-cleanup
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r de55d9d098b8
template: directly instantiate diff options for diffstat

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -27,6 +27,7 @@  from . import (
     util,
 )
 from .utils import (
+    diffutil,
     stringutil,
 )
 
@@ -262,7 +263,8 @@  def showdiffstat(context, mapping):
     "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)