[PATCH 06 of 12 V2] template: directly instantiate diff options for diffstat
Boris Feld
boris.feld at octobus.net
Tue Jul 3 06:32:25 EDT 2018
# HG changeset patch
# User Boris Feld <boris.feld at 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
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)
More information about the Mercurial-devel
mailing list