##// END OF EJS Templates
merge changes from stable
Dirkjan Ochtman -
r7500:ab3fb222 merge default
parent child Browse files
Show More
@@ -219,7 +219,7 b' email::'
219 convenient for recipients. Addresses, headers, and parts not
219 convenient for recipients. Addresses, headers, and parts not
220 containing patches of outgoing messages will be encoded in
220 containing patches of outgoing messages will be encoded in
221 the first charset to which conversion from local encoding
221 the first charset to which conversion from local encoding
222 (ui.encoding, ui.fallbackencoding) succeeds. If correct
222 ($HGENCODING, ui.fallbackencoding) succeeds. If correct
223 conversion fails, the text in question is sent as is.
223 conversion fails, the text in question is sent as is.
224 Defaults to empty (explicit) list.
224 Defaults to empty (explicit) list.
225
225
@@ -228,7 +228,7 b' email::'
228 us-ascii always first, regardless of settings
228 us-ascii always first, regardless of settings
229 email.charsets in order given by user
229 email.charsets in order given by user
230 ui.fallbackencoding if not in email.charsets
230 ui.fallbackencoding if not in email.charsets
231 ui.encoding if not in email.charsets
231 $HGENCODING if not in email.charsets
232 utf-8 always last, regardless of settings
232 utf-8 always last, regardless of settings
233
233
234 Email example:
234 Email example:
@@ -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) for s in subs]
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, self.charsets)
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, self.charsets)
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