63 # glob patterns are matched against path to repo root. |
63 # glob patterns are matched against path to repo root. |
64 # |
64 # |
65 # if you like, you can put notify config file in repo that users can |
65 # if you like, you can put notify config file in repo that users can |
66 # push changes to, they can manage their own subscriptions. |
66 # push changes to, they can manage their own subscriptions. |
67 |
67 |
68 from mercurial.demandload import * |
68 from mercurial.i18n import _ |
69 from mercurial.i18n import gettext as _ |
|
70 from mercurial.node import * |
69 from mercurial.node import * |
71 demandload(globals(), 'mercurial:patch,cmdutil,templater,util,mail') |
70 from mercurial import patch, cmdutil, templater, util, mail |
72 demandload(globals(), 'email.Parser fnmatch socket time') |
71 import email.Parser, fnmatch, socket, time |
73 |
72 |
74 # template for single changeset can include email headers. |
73 # template for single changeset can include email headers. |
75 single_template = ''' |
74 single_template = ''' |
76 Subject: changeset in {webroot}: {desc|firstline|strip} |
75 Subject: changeset in {webroot}: {desc|firstline|strip} |
77 From: {author} |
76 From: {author} |
111 |
110 |
112 mapfile = self.ui.config('notify', 'style') |
111 mapfile = self.ui.config('notify', 'style') |
113 template = (self.ui.config('notify', hooktype) or |
112 template = (self.ui.config('notify', hooktype) or |
114 self.ui.config('notify', 'template')) |
113 self.ui.config('notify', 'template')) |
115 self.t = cmdutil.changeset_templater(self.ui, self.repo, |
114 self.t = cmdutil.changeset_templater(self.ui, self.repo, |
116 False, None, mapfile, False) |
115 False, mapfile, False) |
117 if not mapfile and not template: |
116 if not mapfile and not template: |
118 template = deftemplates.get(hooktype) or single_template |
117 template = deftemplates.get(hooktype) or single_template |
119 if template: |
118 if template: |
120 template = templater.parsestring(template, quoted=False) |
119 template = templater.parsestring(template, quoted=False) |
121 self.t.use_template(template) |
120 self.t.use_template(template) |