merge changes from stable
authorDirkjan Ochtman <dirkjan@ochtman.nl>
Wed, 10 Dec 2008 11:30:11 +0100
changeset 7500 ab3fb222b345
parent 7496 0a27d0db256d (current diff)
parent 7499 613f3c88a388 (diff)
child 7501 732c54abd592
child 7505 fe0e02f952b0
merge changes from stable
--- a/doc/hgrc.5.txt	Tue Dec 09 17:01:14 2008 -0800
+++ b/doc/hgrc.5.txt	Wed Dec 10 11:30:11 2008 +0100
@@ -219,7 +219,7 @@
     convenient for recipients. Addresses, headers, and parts not
     containing patches of outgoing messages will be encoded in
     the first charset to which conversion from local encoding
-    (ui.encoding, ui.fallbackencoding) succeeds. If correct
+    ($HGENCODING, ui.fallbackencoding) succeeds. If correct
     conversion fails, the text in question is sent as is.
     Defaults to empty (explicit) list.
 
@@ -228,7 +228,7 @@
     us-ascii             always first, regardless of settings
     email.charsets       in order given by user
     ui.fallbackencoding  if not in email.charsets
-    ui.encoding          if not in email.charsets
+    $HGENCODING          if not in email.charsets
     utf-8                always last, regardless of settings
 
   Email example:
--- a/hgext/notify.py	Tue Dec 09 17:01:14 2008 -0800
+++ b/hgext/notify.py	Wed Dec 10 11:30:11 2008 +0100
@@ -105,6 +105,7 @@
         self.stripcount = int(self.ui.config('notify', 'strip', 0))
         self.root = self.strip(self.repo.root)
         self.domain = self.ui.config('notify', 'domain')
+        self.test = self.ui.configbool('notify', 'test', True)
         self.charsets = mail._charsets(self.ui)
         self.subs = self.subscribers()
 
@@ -157,7 +158,8 @@
                 for user in users.split(','):
                     subs[self.fixmail(user)] = 1
         subs = util.sort(subs)
-        return [mail.addressencode(self.ui, s, self.charsets) for s in subs]
+        return [mail.addressencode(self.ui, s, self.charsets, self.test)
+                for s in subs]
 
     def url(self, path=None):
         return self.ui.config('web', 'baseurl') + (path or self.root)
@@ -186,7 +188,7 @@
         # create fresh mime message from msg body
         text = msg.get_payload()
         # for notification prefer readability over data precision
-        msg = mail.mimeencode(self.ui, text, self.charsets)
+        msg = mail.mimeencode(self.ui, text, self.charsets, self.test)
 
         def fix_subject(subject):
             '''try to make subject line exist and be useful.'''
@@ -201,7 +203,8 @@
             maxsubject = int(self.ui.config('notify', 'maxsubject', 67))
             if maxsubject and len(subject) > maxsubject:
                 subject = subject[:maxsubject-3] + '...'
-            msg['Subject'] = mail.headencode(self.ui, subject, self.charsets)
+            msg['Subject'] = mail.headencode(self.ui, subject,
+                                             self.charsets, self.test)
 
         def fix_sender(sender):
             '''try to make message have proper sender.'''
@@ -210,7 +213,8 @@
                 sender = self.ui.config('email', 'from') or self.ui.username()
             if '@' not in sender or '@localhost' in sender:
                 sender = self.fixmail(sender)
-            msg['From'] = mail.addressencode(self.ui, sender, self.charsets)
+            msg['From'] = mail.addressencode(self.ui, sender,
+                                             self.charsets, self.test)
 
         msg['Date'] = util.datestr(format="%a, %d %b %Y %H:%M:%S %1%2")
         fix_subject(subject)
@@ -224,7 +228,7 @@
         msg['To'] = ', '.join(self.subs)
 
         msgtext = msg.as_string(0)
-        if self.ui.configbool('notify', 'test', True):
+        if self.test:
             self.ui.write(msgtext)
             if not msgtext.endswith('\n'):
                 self.ui.write('\n')