##// END OF EJS Templates
templatekw: obtain ui directly from the template context
Yuya Nishihara -
r38602:4bc96c75 default
parent child Browse files
Show More
@@ -258,13 +258,14 b' def showdescription(context, mapping):'
258 else:
258 else:
259 return s.strip()
259 return s.strip()
260
260
261 @templatekeyword('diffstat', requires={'ctx'})
261 @templatekeyword('diffstat', requires={'ui', 'ctx'})
262 def showdiffstat(context, mapping):
262 def showdiffstat(context, mapping):
263 """String. Statistics of changes with the following format:
263 """String. Statistics of changes with the following format:
264 "modified files: +added/-removed lines"
264 "modified files: +added/-removed lines"
265 """
265 """
266 ui = context.resource(mapping, 'ui')
266 ctx = context.resource(mapping, 'ctx')
267 ctx = context.resource(mapping, 'ctx')
267 diffopts = diffutil.diffopts(ctx._repo.ui, {'noprefix': False})
268 diffopts = diffutil.diffopts(ui, {'noprefix': False})
268 diff = ctx.diff(opts=diffopts)
269 diff = ctx.diff(opts=diffopts)
269 stats = patch.diffstatdata(util.iterlines(diff))
270 stats = patch.diffstatdata(util.iterlines(diff))
270 maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
271 maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
General Comments 0
You need to be logged in to leave comments. Login now