# HG changeset patch # User Yuya Nishihara # Date 2018-07-06 12:29:05 # Node ID 4bc96c755c176bf37b882c24d70e66f6c62a233b # Parent 7f4bf81101507644d92347aaa0d9d9c1043842d1 templatekw: obtain ui directly from the template context diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -258,13 +258,14 @@ def showdescription(context, mapping): else: return s.strip() -@templatekeyword('diffstat', requires={'ctx'}) +@templatekeyword('diffstat', requires={'ui', 'ctx'}) def showdiffstat(context, mapping): """String. Statistics of changes with the following format: "modified files: +added/-removed lines" """ + ui = context.resource(mapping, 'ui') ctx = context.resource(mapping, 'ctx') - diffopts = diffutil.diffopts(ctx._repo.ui, {'noprefix': False}) + diffopts = diffutil.diffopts(ui, {'noprefix': False}) diff = ctx.diff(opts=diffopts) stats = patch.diffstatdata(util.iterlines(diff)) maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)