Show More
@@ -196,9 +196,11 b' class notifier(object):' | |||||
196 | self.subs = self.subscribers() |
|
196 | self.subs = self.subscribers() | |
197 | self.merge = self.ui.configbool('notify', 'merge', True) |
|
197 | self.merge = self.ui.configbool('notify', 'merge', True) | |
198 |
|
198 | |||
199 | mapfile = self.ui.config('notify', 'style') |
|
199 | mapfile = None | |
200 | template = (self.ui.config('notify', hooktype) or |
|
200 | template = (self.ui.config('notify', hooktype) or | |
201 | self.ui.config('notify', 'template')) |
|
201 | self.ui.config('notify', 'template')) | |
|
202 | if not template: | |||
|
203 | mapfile = self.ui.config('notify', 'style') | |||
202 | if not mapfile and not template: |
|
204 | if not mapfile and not template: | |
203 | template = deftemplates.get(hooktype) or single_template |
|
205 | template = deftemplates.get(hooktype) or single_template | |
204 | self.t = cmdutil.changeset_templater(self.ui, self.repo, False, None, |
|
206 | self.t = cmdutil.changeset_templater(self.ui, self.repo, False, None, |
@@ -553,3 +553,76 b' from different branch' | |||||
553 | description: test |
|
553 | description: test | |
554 | (run 'hg heads' to see heads) |
|
554 | (run 'hg heads' to see heads) | |
555 |
|
555 | |||
|
556 | default template: | |||
|
557 | ||||
|
558 | $ grep -v '^template =' $HGRCPATH > "$HGRCPATH.new" | |||
|
559 | $ mv "$HGRCPATH.new" $HGRCPATH | |||
|
560 | $ echo a >> a/a | |||
|
561 | $ hg --cwd a commit -m 'default template' | |||
|
562 | $ hg --cwd b pull ../a -q | \ | |||
|
563 | > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),' | |||
|
564 | Content-Type: text/plain; charset="us-ascii" | |||
|
565 | MIME-Version: 1.0 | |||
|
566 | Content-Transfer-Encoding: 7bit | |||
|
567 | Date: * (glob) | |||
|
568 | Subject: changeset in b: default template | |||
|
569 | From: test@test.com | |||
|
570 | X-Hg-Notification: changeset 3548c9e294b6 | |||
|
571 | Message-Id: <hg.3548c9e294b6.*.*@*> (glob) | |||
|
572 | To: baz@test.com, foo@bar | |||
|
573 | ||||
|
574 | changeset 3548c9e294b6 in $TESTTMP/b | |||
|
575 | details: http://test/b?cmd=changeset;node=3548c9e294b6 | |||
|
576 | description: default template | |||
|
577 | ||||
|
578 | with style: | |||
|
579 | ||||
|
580 | $ cat <<EOF > notifystyle.map | |||
|
581 | > changeset = "Subject: {desc|firstline|strip} | |||
|
582 | > From: {author} | |||
|
583 | > {""} | |||
|
584 | > changeset {node|short}" | |||
|
585 | > EOF | |||
|
586 | $ cat <<EOF >> $HGRCPATH | |||
|
587 | > [notify] | |||
|
588 | > style = $TESTTMP/notifystyle.map | |||
|
589 | > EOF | |||
|
590 | $ echo a >> a/a | |||
|
591 | $ hg --cwd a commit -m 'with style' | |||
|
592 | $ hg --cwd b pull ../a -q | \ | |||
|
593 | > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),' | |||
|
594 | Content-Type: text/plain; charset="us-ascii" | |||
|
595 | MIME-Version: 1.0 | |||
|
596 | Content-Transfer-Encoding: 7bit | |||
|
597 | Date: * (glob) | |||
|
598 | Subject: with style | |||
|
599 | From: test@test.com | |||
|
600 | X-Hg-Notification: changeset e917dbd961d3 | |||
|
601 | Message-Id: <hg.e917dbd961d3.*.*@*> (glob) | |||
|
602 | To: baz@test.com, foo@bar | |||
|
603 | ||||
|
604 | changeset e917dbd961d3 | |||
|
605 | ||||
|
606 | with template (overrides style): | |||
|
607 | ||||
|
608 | $ cat <<EOF >> $HGRCPATH | |||
|
609 | > template = Subject: {node|short}: {desc|firstline|strip} | |||
|
610 | > From: {author} | |||
|
611 | > {""} | |||
|
612 | > {desc} | |||
|
613 | > EOF | |||
|
614 | $ echo a >> a/a | |||
|
615 | $ hg --cwd a commit -m 'with template' | |||
|
616 | $ hg --cwd b pull ../a -q | \ | |||
|
617 | > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),' | |||
|
618 | Content-Type: text/plain; charset="us-ascii" | |||
|
619 | MIME-Version: 1.0 | |||
|
620 | Content-Transfer-Encoding: 7bit | |||
|
621 | Date: * (glob) | |||
|
622 | Subject: a09743fd3edd: with template | |||
|
623 | From: test@test.com | |||
|
624 | X-Hg-Notification: changeset a09743fd3edd | |||
|
625 | Message-Id: <hg.a09743fd3edd.*.*@*> (glob) | |||
|
626 | To: baz@test.com, foo@bar | |||
|
627 | ||||
|
628 | with template |
General Comments 0
You need to be logged in to leave comments.
Login now