diff mercurial/templatekw.py @ 38523:4455e5d4d59c

context: explicitly take diffopts in `context.diff` (API) To provide a proper replacement for the `patch.diff(?)` function, the `context.diff(?)` method needs to be able to take more parameters. To distinguish the diff options from the new other arguments, we upgrade the diff options to its own explicit argument.
author Boris Feld <boris.feld@octobus.net>
date Tue, 22 May 2018 15:02:52 +0200
parents 523f64466a05
children f2f9bacf0587
line wrap: on
line diff
--- a/mercurial/templatekw.py	Sun Jul 01 01:00:39 2018 +0530
+++ b/mercurial/templatekw.py	Tue May 22 15:02:52 2018 +0200
@@ -263,7 +263,8 @@
     "modified files: +added/-removed lines"
     """
     ctx = context.resource(mapping, 'ctx')
-    stats = patch.diffstatdata(util.iterlines(ctx.diff(noprefix=False)))
+    diff = ctx.diff(opts={'noprefix': False})
+    stats = patch.diffstatdata(util.iterlines(diff))
     maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
     return '%d: +%d/-%d' % (len(stats), adds, removes)