Show More
@@ -196,35 +196,29 b' class notifier(object):' | |||||
196 | for k, v in headers: |
|
196 | for k, v in headers: | |
197 | msg[k] = v |
|
197 | msg[k] = v | |
198 |
|
198 | |||
199 | def fix_subject(subject): |
|
199 | msg['Date'] = util.datestr(format="%a, %d %b %Y %H:%M:%S %1%2") | |
200 | '''try to make subject line exist and be useful.''' |
|
|||
201 |
|
200 | |||
202 | if not subject: |
|
201 | # try to make subject line exist and be useful | |
203 | if count > 1: |
|
202 | if not subject: | |
204 | subject = _('%s: %d new changesets') % (self.root, count) |
|
203 | if count > 1: | |
205 | else: |
|
204 | subject = _('%s: %d new changesets') % (self.root, count) | |
206 | changes = self.repo.changelog.read(node) |
|
205 | else: | |
207 | s = changes[4].lstrip().split('\n', 1)[0].rstrip() |
|
206 | changes = self.repo.changelog.read(node) | |
208 | subject = '%s: %s' % (self.root, s) |
|
207 | s = changes[4].lstrip().split('\n', 1)[0].rstrip() | |
209 | maxsubject = int(self.ui.config('notify', 'maxsubject', 67)) |
|
208 | subject = '%s: %s' % (self.root, s) | |
210 | if maxsubject and len(subject) > maxsubject: |
|
209 | maxsubject = int(self.ui.config('notify', 'maxsubject', 67)) | |
211 | subject = subject[:maxsubject-3] + '...' |
|
210 | if maxsubject and len(subject) > maxsubject: | |
212 | msg['Subject'] = mail.headencode(self.ui, subject, |
|
211 | subject = subject[:maxsubject-3] + '...' | |
213 | self.charsets, self.test) |
|
212 | msg['Subject'] = mail.headencode(self.ui, subject, | |
|
213 | self.charsets, self.test) | |||
214 |
|
214 | |||
215 | def fix_sender(sender): |
|
215 | # try to make message have proper sender | |
216 | '''try to make message have proper sender.''' |
|
216 | if not sender: | |
217 |
|
217 | sender = self.ui.config('email', 'from') or self.ui.username() | ||
218 | if not sender: |
|
218 | if '@' not in sender or '@localhost' in sender: | |
219 |
|
|
219 | sender = self.fixmail(sender) | |
220 | if '@' not in sender or '@localhost' in sender: |
|
220 | msg['From'] = mail.addressencode(self.ui, sender, | |
221 | sender = self.fixmail(sender) |
|
221 | self.charsets, self.test) | |
222 | msg['From'] = mail.addressencode(self.ui, sender, |
|
|||
223 | self.charsets, self.test) |
|
|||
224 |
|
||||
225 | msg['Date'] = util.datestr(format="%a, %d %b %Y %H:%M:%S %1%2") |
|
|||
226 | fix_subject(subject) |
|
|||
227 | fix_sender(sender) |
|
|||
228 |
|
222 | |||
229 | msg['X-Hg-Notification'] = 'changeset ' + short(node) |
|
223 | msg['X-Hg-Notification'] = 'changeset ' + short(node) | |
230 | if not msg['Message-Id']: |
|
224 | if not msg['Message-Id']: |
General Comments 0
You need to be logged in to leave comments.
Login now