##// END OF EJS Templates
notify: add option to include function names in the diff output...
Joerg Sonnenberger -
r38048:d1134ca5 default
parent child Browse files
Show More
@@ -113,6 +113,9 b' notify.maxsubject'
113 notify.diffstat
113 notify.diffstat
114 Set to True to include a diffstat before diff content. Default: True.
114 Set to True to include a diffstat before diff content. Default: True.
115
115
116 notify.showfunc
117 If set, override ``diff.showfunc`` for the diff content. Default: None.
118
116 notify.merge
119 notify.merge
117 If True, send notifications for merge changesets. Default: True.
120 If True, send notifications for merge changesets. Default: True.
118
121
@@ -206,6 +209,9 b" configitem('notify', 'outgoing',"
206 configitem('notify', 'sources',
209 configitem('notify', 'sources',
207 default='serve',
210 default='serve',
208 )
211 )
212 configitem('notify', 'showfunc',
213 default=None,
214 )
209 configitem('notify', 'strip',
215 configitem('notify', 'strip',
210 default=0,
216 default=0,
211 )
217 )
@@ -260,6 +266,9 b' class notifier(object):'
260 self.charsets = mail._charsets(self.ui)
266 self.charsets = mail._charsets(self.ui)
261 self.subs = self.subscribers()
267 self.subs = self.subscribers()
262 self.merge = self.ui.configbool('notify', 'merge')
268 self.merge = self.ui.configbool('notify', 'merge')
269 self.showfunc = self.ui.configbool('notify', 'showfunc')
270 if self.showfunc is None:
271 self.showfunc = self.ui.configbool('diff', 'showfunc')
263
272
264 mapfile = None
273 mapfile = None
265 template = (self.ui.config('notify', hooktype) or
274 template = (self.ui.config('notify', hooktype) or
@@ -420,8 +429,9 b' class notifier(object):'
420 ref = ref.node()
429 ref = ref.node()
421 else:
430 else:
422 ref = ctx.node()
431 ref = ctx.node()
423 chunks = patch.diff(self.repo, prev, ref,
432 diffopts = patch.diffallopts(self.ui)
424 opts=patch.diffallopts(self.ui))
433 diffopts.showfunc = self.showfunc
434 chunks = patch.diff(self.repo, prev, ref, opts=diffopts)
425 difflines = ''.join(chunks).splitlines()
435 difflines = ''.join(chunks).splitlines()
426
436
427 if self.ui.configbool('notify', 'diffstat'):
437 if self.ui.configbool('notify', 'diffstat'):
@@ -131,6 +131,9 b''
131 notify.diffstat
131 notify.diffstat
132 Set to True to include a diffstat before diff content. Default: True.
132 Set to True to include a diffstat before diff content. Default: True.
133
133
134 notify.showfunc
135 If set, override "diff.showfunc" for the diff content. Default: None.
136
134 notify.merge
137 notify.merge
135 If True, send notifications for merge changesets. Default: True.
138 If True, send notifications for merge changesets. Default: True.
136
139
@@ -647,3 +650,99 b' with template (overrides style):'
647 To: baz@test.com, foo@bar
650 To: baz@test.com, foo@bar
648
651
649 with template
652 with template
653
654 showfunc diff
655 $ cat <<EOF >> $HGRCPATH
656 > showfunc = True
657 > template =
658 > maxdiff = -1
659 > EOF
660 $ cd a
661 $ cat > f1 << EOF
662 > int main() {
663 > int a = 0;
664 > int b = 1;
665 > int c = 2;
666 > int d = 3;
667 > return a + b + c + d;
668 > }
669 > EOF
670 $ hg commit -Am addfunction
671 adding f1
672 $ hg --cwd ../b pull ../a
673 pulling from ../a
674 searching for changes
675 adding changesets
676 adding manifests
677 adding file changes
678 added 1 changesets with 1 changes to 1 files
679 new changesets b86bc16ff894
680 MIME-Version: 1.0
681 Content-Type: text/plain; charset="us-ascii"
682 Content-Transfer-Encoding: 7bit
683 Date: * (glob)
684 Subject: addfunction
685 From: test@test.com
686 X-Hg-Notification: changeset b86bc16ff894
687 Message-Id: <hg.b86bc16ff894.*.*@*> (glob)
688 To: baz@test.com, foo@bar
689
690 changeset b86bc16ff894
691 diffs (11 lines):
692
693 diff -r 14721b538ae3 -r b86bc16ff894 f1
694 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
695 +++ b/f1 Thu Jan 01 00:00:00 1970 +0000
696 @@ -0,0 +1,7 @@
697 +int main() {
698 + int a = 0;
699 + int b = 1;
700 + int c = 2;
701 + int d = 3;
702 + return a + b + c + d;
703 +}
704 (run 'hg update' to get a working copy)
705 $ cat > f1 << EOF
706 > int main() {
707 > int a = 0;
708 > int b = 1;
709 > int c = 2;
710 > int e = 3;
711 > return a + b + c + e;
712 > }
713 > EOF
714 $ hg commit -m changefunction
715 $ hg --cwd ../b --config notify.showfunc=True pull ../a
716 pulling from ../a
717 searching for changes
718 adding changesets
719 adding manifests
720 adding file changes
721 added 1 changesets with 1 changes to 1 files
722 new changesets e81040e9838c
723 MIME-Version: 1.0
724 Content-Type: text/plain; charset="us-ascii"
725 Content-Transfer-Encoding: 7bit
726 Date: * (glob)
727 Subject: changefunction
728 From: test@test.com
729 X-Hg-Notification: changeset e81040e9838c
730 Message-Id: <hg.e81040e9838c.*.*@*> (glob)
731 To: baz@test.com, foo@bar
732
733 changeset e81040e9838c
734 diffs (12 lines):
735
736 diff -r b86bc16ff894 -r e81040e9838c f1
737 --- a/f1 Thu Jan 01 00:00:00 1970 +0000
738 +++ b/f1 Thu Jan 01 00:00:00 1970 +0000
739 @@ -2,6 +2,6 @@ int main() {
740 int a = 0;
741 int b = 1;
742 int c = 2;
743 - int d = 3;
744 - return a + b + c + d;
745 + int e = 3;
746 + return a + b + c + e;
747 }
748 (run 'hg update' to get a working copy)
General Comments 0
You need to be logged in to leave comments. Login now