changeset 7889:5ac1a72e5b74

patchbomb: option to set the name of bundle attachment (issue1452) specifying --bundlename=NAME will create a "NAME.hg" attachment
author John Mulligan <phlogistonjohn@asynchrono.us>
date Sat, 14 Mar 2009 10:46:48 -0400
parents 206334f8aa0b
children e710f0f592b2
files hgext/patchbomb.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/patchbomb.py	Tue Mar 24 16:41:41 2009 -0500
+++ b/hgext/patchbomb.py	Sat Mar 14 10:46:48 2009 -0400
@@ -344,8 +344,9 @@
             msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test')))
         datapart = email.MIMEBase.MIMEBase('application', 'x-mercurial-bundle')
         datapart.set_payload(bundle)
+        bundlename = '%s.hg' % opts.get('bundlename', 'bundle')
         datapart.add_header('Content-Disposition', 'attachment',
-                            filename='bundle.hg')
+                            filename=bundlename)
         email.Encoders.encode_base64(datapart)
         msg.attach(datapart)
         msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get('test'))
@@ -468,6 +469,8 @@
            _('send changes not found in the target repository')),
           ('b', 'bundle', None,
            _('send changes not in target as a binary bundle')),
+          ('', 'bundlename', 'bundle',
+           _('file name of the bundle attachment')),
           ('r', 'rev', [], _('a revision to send')),
           ('', 'force', None,
            _('run even when remote repository is unrelated (with -b)')),