[PATCH] Teach patchbomb to send base64 encoded attachments (for braindead

peter.kourzanov at xs4all.nl peter.kourzanov at xs4all.nl
Tue May 20 10:18:48 CDT 2008


# HG changeset patch
# User Pjotr Kourzanov <peter.kourzanov at xs4all.nl>
# Date 1211296635 -7200
# Node ID 22c635868d6bba769d3ad29a29e084cda75dc9a0
# Parent  d47d7d28c19b78d11b5f6e34afb955b35be77066
Teach patchbomb to send base64 encoded attachments (for braindead
clients like Notes).

Adds a new option -j, which when used together with -a should exhibit
required behaviour.

Alternatively, the email/patchbomb option of encoding can be used:

[email]
encoding = base64

diff -r d47d7d28c19b -r 22c635868d6b hgext/patchbomb.py
--- a/hgext/patchbomb.py	Tue May 20 17:15:05 2008 +0200
+++ b/hgext/patchbomb.py	Tue May 20 17:17:15 2008 +0200
@@ -196,6 +196,11 @@
             if opts['attach']:
                 disposition = 'attachment'
             p['Content-Disposition'] = disposition + '; filename=' + patchname
+            if not opts.get('inline') and (\
+               opts.get('base64') or\
+               ui.config('email', 'encoding')=='base64' or\
+               ui.config('patchbomb', 'encoding')=='base64'):
+      	        email.Encoders.encode_base64(p)
             msg.attach(p)
         else:
             body += '\n'.join(patch)
@@ -441,6 +446,7 @@
         (patchbomb,
          [('a', 'attach', None, _('send patches as attachments')),
           ('i', 'inline', None, _('send patches as inline attachments')),
+          ('j', 'base64', None, _('encode patches with base64 (requires sending them as attachments)')),
           ('', 'bcc', [], _('email addresses of blind copy recipients')),
           ('c', 'cc', [], _('email addresses of copy recipients')),
           ('d', 'diffstat', None, _('add diffstat output to messages')),


More information about the Mercurial-devel mailing list