D3553: notify: add option to include function names in the diff output
yuja added a comment. Queued, thanks. > + $ hg commit -m changefunction > + $ hg --cwd ../b --config notify.show-functions=True pull ../a s/show-functions/showfunc/ REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3553 To: joerg.sonnenberger, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3553: notify: add option to include function names in the diff output
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd1134ca5b1a3: notify: add option to include function names in the diff output (authored by joerg.sonnenberger, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D3553?vs=8715&id=8726#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3553?vs=8715&id=8726 REVISION DETAIL https://phab.mercurial-scm.org/D3553 AFFECTED FILES hgext/notify.py tests/test-notify.t CHANGE DETAILS diff --git a/tests/test-notify.t b/tests/test-notify.t --- a/tests/test-notify.t +++ b/tests/test-notify.t @@ -131,6 +131,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. @@ -647,3 +650,99 @@ To: b...@test.com, foo@bar with template + +showfunc diff + $ cat <> $HGRCPATH + > showfunc = True + > template = + > maxdiff = -1 + > EOF + $ cd a + $ cat > f1 << EOF + > int main() { + > int a = 0; + > int b = 1; + > int c = 2; + > int d = 3; + > return a + b + c + d; + > } + > EOF + $ hg commit -Am addfunction + adding f1 + $ hg --cwd ../b pull ../a + pulling from ../a + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + new changesets b86bc16ff894 + MIME-Version: 1.0 + Content-Type: text/plain; charset="us-ascii" + Content-Transfer-Encoding: 7bit + Date: * (glob) + Subject: addfunction + From: t...@test.com + X-Hg-Notification: changeset b86bc16ff894 + Message-Id: (glob) + To: b...@test.com, foo@bar + + changeset b86bc16ff894 + diffs (11 lines): + + diff -r 14721b538ae3 -r b86bc16ff894 f1 + --- /dev/nullThu Jan 01 00:00:00 1970 + + +++ b/f1 Thu Jan 01 00:00:00 1970 + + @@ -0,0 +1,7 @@ + +int main() { + +int a = 0; + +int b = 1; + +int c = 2; + +int d = 3; + +return a + b + c + d; + +} + (run 'hg update' to get a working copy) + $ cat > f1 << EOF + > int main() { + > int a = 0; + > int b = 1; + > int c = 2; + > int e = 3; + > return a + b + c + e; + > } + > EOF + $ hg commit -m changefunction + $ hg --cwd ../b --config notify.showfunc=True pull ../a + pulling from ../a + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + new changesets e81040e9838c + MIME-Version: 1.0 + Content-Type: text/plain; charset="us-ascii" + Content-Transfer-Encoding: 7bit + Date: * (glob) + Subject: changefunction + From: t...@test.com + X-Hg-Notification: changeset e81040e9838c + Message-Id: (glob) + To: b...@test.com, foo@bar + + changeset e81040e9838c + diffs (12 lines): + + diff -r b86bc16ff894 -r e81040e9838c f1 + --- a/f1 Thu Jan 01 00:00:00 1970 + + +++ b/f1 Thu Jan 01 00:00:00 1970 + + @@ -2,6 +2,6 @@ int main() { + int a = 0; + int b = 1; + int c = 2; + -int d = 3; + -return a + b + c + d; + +int e = 3; + +return a + b + c + e; + } + (run 'hg update' to get a working copy) diff --git a/hgext/notify.py b/hgext/notify.py --- a/hgext/notify.py +++ b/hgext/notify.py @@ -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'): To: joerg.sonnenberger, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercuri
Re: D3553: notify: add option to include function names in the diff output
Queued, thanks. > + $ hg commit -m changefunction > + $ hg --cwd ../b --config notify.show-functions=True pull ../a s/show-functions/showfunc/ ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3553: notify: add option to include function names in the diff output
joerg.sonnenberger updated this revision to Diff 8715. joerg.sonnenberger edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3553?vs=8673&id=8715 REVISION DETAIL https://phab.mercurial-scm.org/D3553 AFFECTED FILES hgext/notify.py tests/test-notify.t CHANGE DETAILS diff --git a/tests/test-notify.t b/tests/test-notify.t --- a/tests/test-notify.t +++ b/tests/test-notify.t @@ -131,6 +131,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. @@ -647,3 +650,99 @@ To: b...@test.com, foo@bar with template + +showfunc diff + $ cat <> $HGRCPATH + > showfunc = True + > template = + > maxdiff = -1 + > EOF + $ cd a + $ cat > f1 << EOF + > int main() { + > int a = 0; + > int b = 1; + > int c = 2; + > int d = 3; + > return a + b + c + d; + > } + > EOF + $ hg commit -Am addfunction + adding f1 + $ hg --cwd ../b pull ../a + pulling from ../a + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + new changesets b86bc16ff894 + MIME-Version: 1.0 + Content-Type: text/plain; charset="us-ascii" + Content-Transfer-Encoding: 7bit + Date: * (glob) + Subject: addfunction + From: t...@test.com + X-Hg-Notification: changeset b86bc16ff894 + Message-Id: (glob) + To: b...@test.com, foo@bar + + changeset b86bc16ff894 + diffs (11 lines): + + diff -r 14721b538ae3 -r b86bc16ff894 f1 + --- /dev/nullThu Jan 01 00:00:00 1970 + + +++ b/f1 Thu Jan 01 00:00:00 1970 + + @@ -0,0 +1,7 @@ + +int main() { + +int a = 0; + +int b = 1; + +int c = 2; + +int d = 3; + +return a + b + c + d; + +} + (run 'hg update' to get a working copy) + $ cat > f1 << EOF + > int main() { + > int a = 0; + > int b = 1; + > int c = 2; + > int e = 3; + > return a + b + c + e; + > } + > EOF + $ hg commit -m changefunction + $ hg --cwd ../b --config notify.show-functions=True pull ../a + pulling from ../a + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + new changesets e81040e9838c + MIME-Version: 1.0 + Content-Type: text/plain; charset="us-ascii" + Content-Transfer-Encoding: 7bit + Date: * (glob) + Subject: changefunction + From: t...@test.com + X-Hg-Notification: changeset e81040e9838c + Message-Id: (glob) + To: b...@test.com, foo@bar + + changeset e81040e9838c + diffs (12 lines): + + diff -r b86bc16ff894 -r e81040e9838c f1 + --- a/f1 Thu Jan 01 00:00:00 1970 + + +++ b/f1 Thu Jan 01 00:00:00 1970 + + @@ -2,6 +2,6 @@ int main() { + int a = 0; + int b = 1; + int c = 2; + -int d = 3; + -return a + b + c + d; + +int e = 3; + +return a + b + c + e; + } + (run 'hg update' to get a working copy) diff --git a/hgext/notify.py b/hgext/notify.py --- a/hgext/notify.py +++ b/hgext/notify.py @@ -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'): To: joerg.sonnenberger, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3553: notify: add option to include function names in the diff output
yuja added a comment. > + notify.show-functions > +Set to True to get the equivalent of "hg diff --show-functions". Default: > +False So is this equivalent to setting the diff option? [diff] showfunc = True I'm not sure if we need `notify.show-functions` in addition to `diff.*` options, but if we do need it, it's probably better to copy the option name from `[diff]`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3553 To: joerg.sonnenberger, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D3553: notify: add option to include function names in the diff output
> + notify.show-functions > +Set to True to get the equivalent of "hg diff --show-functions". Default: > +False So is this equivalent to setting the diff option? ``` [diff] showfunc = True ``` I'm not sure if we need `notify.show-functions` in addition to `diff.*` options, but if we do need it, it's probably better to copy the option name from `[diff]`. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3553: notify: add option to include function names in the diff output
joerg.sonnenberger created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is the equivalent of ``hg diff -p``. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3553 AFFECTED FILES hgext/notify.py tests/test-notify.t CHANGE DETAILS diff --git a/tests/test-notify.t b/tests/test-notify.t --- a/tests/test-notify.t +++ b/tests/test-notify.t @@ -131,6 +131,10 @@ notify.diffstat Set to True to include a diffstat before diff content. Default: True. + notify.show-functions +Set to True to get the equivalent of "hg diff --show-functions". Default: +False + notify.merge If True, send notifications for merge changesets. Default: True. @@ -647,3 +651,99 @@ To: b...@test.com, foo@bar with template + +showfunc diff + $ cat <> $HGRCPATH + > show-functions = True + > template = + > maxdiff = -1 + > EOF + $ cd a + $ cat > f1 << EOF + > int main() { + > int a = 0; + > int b = 1; + > int c = 2; + > int d = 3; + > return a + b + c + d; + > } + > EOF + $ hg commit -Am addfunction + adding f1 + $ hg --cwd ../b pull ../a + pulling from ../a + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + new changesets b86bc16ff894 + MIME-Version: 1.0 + Content-Type: text/plain; charset="us-ascii" + Content-Transfer-Encoding: 7bit + Date: * (glob) + Subject: addfunction + From: t...@test.com + X-Hg-Notification: changeset b86bc16ff894 + Message-Id: (glob) + To: b...@test.com, foo@bar + + changeset b86bc16ff894 + diffs (11 lines): + + diff -r 14721b538ae3 -r b86bc16ff894 f1 + --- /dev/nullThu Jan 01 00:00:00 1970 + + +++ b/f1 Thu Jan 01 00:00:00 1970 + + @@ -0,0 +1,7 @@ + +int main() { + +int a = 0; + +int b = 1; + +int c = 2; + +int d = 3; + +return a + b + c + d; + +} + (run 'hg update' to get a working copy) + $ cat > f1 << EOF + > int main() { + > int a = 0; + > int b = 1; + > int c = 2; + > int e = 3; + > return a + b + c + e; + > } + > EOF + $ hg commit -m changefunction + $ hg --cwd ../b --config notify.show-functions=True pull ../a + pulling from ../a + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + new changesets e81040e9838c + MIME-Version: 1.0 + Content-Type: text/plain; charset="us-ascii" + Content-Transfer-Encoding: 7bit + Date: * (glob) + Subject: changefunction + From: t...@test.com + X-Hg-Notification: changeset e81040e9838c + Message-Id: (glob) + To: b...@test.com, foo@bar + + changeset e81040e9838c + diffs (12 lines): + + diff -r b86bc16ff894 -r e81040e9838c f1 + --- a/f1 Thu Jan 01 00:00:00 1970 + + +++ b/f1 Thu Jan 01 00:00:00 1970 + + @@ -2,6 +2,6 @@ int main() { + int a = 0; + int b = 1; + int c = 2; + -int d = 3; + -return a + b + c + d; + +int e = 3; + +return a + b + c + e; + } + (run 'hg update' to get a working copy) diff --git a/hgext/notify.py b/hgext/notify.py --- a/hgext/notify.py +++ b/hgext/notify.py @@ -113,6 +113,10 @@ notify.diffstat Set to True to include a diffstat before diff content. Default: True. +notify.show-functions + Set to True to get the equivalent of ``hg diff --show-functions``. + Default: False + notify.merge If True, send notifications for merge changesets. Default: True. @@ -206,6 +210,9 @@ configitem('notify', 'sources', default='serve', ) +configitem('notify', 'show-functions', +default=False, +) configitem('notify', 'strip', default=0, ) @@ -260,6 +267,7 @@ self.charsets = mail._charsets(self.ui) self.subs = self.subscribers() self.merge = self.ui.configbool('notify', 'merge') +self.show_functions = self.ui.config('notify', 'show-functions') mapfile = None template = (self.ui.config('notify', hooktype) or @@ -420,8 +428,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.show_functions +chunks = patch.diff(self.repo, prev, ref, opts=diffopts) difflines = ''.join(chunks).splitlines() if self.ui.configbool('notify', 'diffstat'): To: joerg.sonnenberger, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel