##// 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 219 convenient for recipients. Addresses, headers, and parts not
220 220 containing patches of outgoing messages will be encoded in
221 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 223 conversion fails, the text in question is sent as is.
224 224 Defaults to empty (explicit) list.
225 225
@@ -228,7 +228,7 b' email::'
228 228 us-ascii always first, regardless of settings
229 229 email.charsets in order given by user
230 230 ui.fallbackencoding if not in email.charsets
231 ui.encoding if not in email.charsets
231 $HGENCODING if not in email.charsets
232 232 utf-8 always last, regardless of settings
233 233
234 234 Email example:
@@ -105,6 +105,7 b' class notifier(object):'
105 105 self.stripcount = int(self.ui.config('notify', 'strip', 0))
106 106 self.root = self.strip(self.repo.root)
107 107 self.domain = self.ui.config('notify', 'domain')
108 self.test = self.ui.configbool('notify', 'test', True)
108 109 self.charsets = mail._charsets(self.ui)
109 110 self.subs = self.subscribers()
110 111
@@ -157,7 +158,8 b' class notifier(object):'
157 158 for user in users.split(','):
158 159 subs[self.fixmail(user)] = 1
159 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 164 def url(self, path=None):
163 165 return self.ui.config('web', 'baseurl') + (path or self.root)
@@ -186,7 +188,7 b' class notifier(object):'
186 188 # create fresh mime message from msg body
187 189 text = msg.get_payload()
188 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 193 def fix_subject(subject):
192 194 '''try to make subject line exist and be useful.'''
@@ -201,7 +203,8 b' class notifier(object):'
201 203 maxsubject = int(self.ui.config('notify', 'maxsubject', 67))
202 204 if maxsubject and len(subject) > maxsubject:
203 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 209 def fix_sender(sender):
207 210 '''try to make message have proper sender.'''
@@ -210,7 +213,8 b' class notifier(object):'
210 213 sender = self.ui.config('email', 'from') or self.ui.username()
211 214 if '@' not in sender or '@localhost' in sender:
212 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 219 msg['Date'] = util.datestr(format="%a, %d %b %Y %H:%M:%S %1%2")
216 220 fix_subject(subject)
@@ -224,7 +228,7 b' class notifier(object):'
224 228 msg['To'] = ', '.join(self.subs)
225 229
226 230 msgtext = msg.as_string(0)
227 if self.ui.configbool('notify', 'test', True):
231 if self.test:
228 232 self.ui.write(msgtext)
229 233 if not msgtext.endswith('\n'):
230 234 self.ui.write('\n')
General Comments 0
You need to be logged in to leave comments. Login now