Mercurial > public > mercurial-scm > hg-stable
diff hgext/notify.py @ 38070:d1134ca5b1a3
notify: add option to include function names in the diff output
This is a localized version of diff.showfunc.
Differential Revision: https://phab.mercurial-scm.org/D3553
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Sat, 12 May 2018 23:44:08 +0200 |
parents | 68748c2c761b |
children | c7a363ca04b9 |
line wrap: on
line diff
--- a/hgext/notify.py Wed May 16 10:34:31 2018 -0700 +++ b/hgext/notify.py Sat May 12 23:44:08 2018 +0200 @@ -113,6 +113,9 @@ notify.diffstat Set to True to include a diffstat before diff content. Default: True. +notify.showfunc + If set, override ``diff.showfunc`` for the diff content. Default: None. + notify.merge If True, send notifications for merge changesets. Default: True. @@ -206,6 +209,9 @@ configitem('notify', 'sources', default='serve', ) +configitem('notify', 'showfunc', + default=None, +) configitem('notify', 'strip', default=0, ) @@ -260,6 +266,9 @@ self.charsets = mail._charsets(self.ui) self.subs = self.subscribers() self.merge = self.ui.configbool('notify', 'merge') + self.showfunc = self.ui.configbool('notify', 'showfunc') + if self.showfunc is None: + self.showfunc = self.ui.configbool('diff', 'showfunc') mapfile = None template = (self.ui.config('notify', hooktype) or @@ -420,8 +429,9 @@ ref = ref.node() else: ref = ctx.node() - chunks = patch.diff(self.repo, prev, ref, - opts=patch.diffallopts(self.ui)) + diffopts = patch.diffallopts(self.ui) + diffopts.showfunc = self.showfunc + chunks = patch.diff(self.repo, prev, ref, opts=diffopts) difflines = ''.join(chunks).splitlines() if self.ui.configbool('notify', 'diffstat'):