Show More
@@ -105,6 +105,7 b' class notifier(object):' | |||||
105 | self.stripcount = int(self.ui.config('notify', 'strip', 0)) |
|
105 | self.stripcount = int(self.ui.config('notify', 'strip', 0)) | |
106 | self.root = self.strip(self.repo.root) |
|
106 | self.root = self.strip(self.repo.root) | |
107 | self.domain = self.ui.config('notify', 'domain') |
|
107 | self.domain = self.ui.config('notify', 'domain') | |
|
108 | self.test = self.ui.configbool('notify', 'test', True) | |||
108 | self.charsets = mail._charsets(self.ui) |
|
109 | self.charsets = mail._charsets(self.ui) | |
109 | self.subs = self.subscribers() |
|
110 | self.subs = self.subscribers() | |
110 |
|
111 | |||
@@ -157,7 +158,8 b' class notifier(object):' | |||||
157 | for user in users.split(','): |
|
158 | for user in users.split(','): | |
158 | subs[self.fixmail(user)] = 1 |
|
159 | subs[self.fixmail(user)] = 1 | |
159 | subs = util.sort(subs) |
|
160 | subs = util.sort(subs) | |
160 |
return [mail.addressencode(self.ui, s, self.charsets) |
|
161 | return [mail.addressencode(self.ui, s, self.charsets, self.test) | |
|
162 | for s in subs] | |||
161 |
|
163 | |||
162 | def url(self, path=None): |
|
164 | def url(self, path=None): | |
163 | return self.ui.config('web', 'baseurl') + (path or self.root) |
|
165 | return self.ui.config('web', 'baseurl') + (path or self.root) | |
@@ -186,7 +188,7 b' class notifier(object):' | |||||
186 | # create fresh mime message from msg body |
|
188 | # create fresh mime message from msg body | |
187 | text = msg.get_payload() |
|
189 | text = msg.get_payload() | |
188 | # for notification prefer readability over data precision |
|
190 | # for notification prefer readability over data precision | |
189 | msg = mail.mimeencode(self.ui, text, self.charsets) |
|
191 | msg = mail.mimeencode(self.ui, text, self.charsets, self.test) | |
190 |
|
192 | |||
191 | def fix_subject(subject): |
|
193 | def fix_subject(subject): | |
192 | '''try to make subject line exist and be useful.''' |
|
194 | '''try to make subject line exist and be useful.''' | |
@@ -201,7 +203,8 b' class notifier(object):' | |||||
201 | maxsubject = int(self.ui.config('notify', 'maxsubject', 67)) |
|
203 | maxsubject = int(self.ui.config('notify', 'maxsubject', 67)) | |
202 | if maxsubject and len(subject) > maxsubject: |
|
204 | if maxsubject and len(subject) > maxsubject: | |
203 | subject = subject[:maxsubject-3] + '...' |
|
205 | subject = subject[:maxsubject-3] + '...' | |
204 |
msg['Subject'] = mail.headencode(self.ui, subject, |
|
206 | msg['Subject'] = mail.headencode(self.ui, subject, | |
|
207 | self.charsets, self.test) | |||
205 |
|
208 | |||
206 | def fix_sender(sender): |
|
209 | def fix_sender(sender): | |
207 | '''try to make message have proper sender.''' |
|
210 | '''try to make message have proper sender.''' | |
@@ -210,7 +213,8 b' class notifier(object):' | |||||
210 | sender = self.ui.config('email', 'from') or self.ui.username() |
|
213 | sender = self.ui.config('email', 'from') or self.ui.username() | |
211 | if '@' not in sender or '@localhost' in sender: |
|
214 | if '@' not in sender or '@localhost' in sender: | |
212 | sender = self.fixmail(sender) |
|
215 | sender = self.fixmail(sender) | |
213 |
msg['From'] = mail.addressencode(self.ui, sender, |
|
216 | msg['From'] = mail.addressencode(self.ui, sender, | |
|
217 | self.charsets, self.test) | |||
214 |
|
218 | |||
215 | msg['Date'] = util.datestr(format="%a, %d %b %Y %H:%M:%S %1%2") |
|
219 | msg['Date'] = util.datestr(format="%a, %d %b %Y %H:%M:%S %1%2") | |
216 | fix_subject(subject) |
|
220 | fix_subject(subject) | |
@@ -224,7 +228,7 b' class notifier(object):' | |||||
224 | msg['To'] = ', '.join(self.subs) |
|
228 | msg['To'] = ', '.join(self.subs) | |
225 |
|
229 | |||
226 | msgtext = msg.as_string(0) |
|
230 | msgtext = msg.as_string(0) | |
227 | if self.ui.configbool('notify', 'test', True): |
|
231 | if self.test: | |
228 | self.ui.write(msgtext) |
|
232 | self.ui.write(msgtext) | |
229 | if not msgtext.endswith('\n'): |
|
233 | if not msgtext.endswith('\n'): | |
230 | self.ui.write('\n') |
|
234 | self.ui.write('\n') |
General Comments 0
You need to be logged in to leave comments.
Login now