diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -223,6 +223,9 @@ def _getbundle(repo, dest, **opts): ui = repo.ui tmpdir = tempfile.mkdtemp(prefix='hg-email-bundle-') tmpfn = os.path.join(tmpdir, 'bundle') + btype = ui.config('patchbomb', 'bundletype') + if btype: + opts['type'] = btype try: commands.bundle(ui, repo, tmpfn, dest, **opts) fp = open(tmpfn, 'rb') @@ -434,7 +437,8 @@ def patchbomb(ui, repo, *revs, **opts): With -b/--bundle, changesets are selected as for --outgoing, but a single email containing a binary Mercurial bundle as an attachment - will be sent. + will be sent. Use the ``patchbomb.bundletype`` config option to + control the bundle type as with :hg:`bundle --type`. With -m/--mbox, instead of previewing each patchbomb message in a pager or sending the messages directly, it will create a UNIX diff --git a/tests/test-patchbomb.t b/tests/test-patchbomb.t --- a/tests/test-patchbomb.t +++ b/tests/test-patchbomb.t @@ -356,6 +356,48 @@ test bundle and description: Q70eyNw= --===*=-- (glob) +with a specific bundle type +(binary part must be different) + + $ hg email --date '1970-1-1 0:3' -n -f quux -t foo \ + > -c bar -s test -r tip -b --desc description \ + > --config patchbomb.bundletype=gzip | $FILTERBOUNDARY + searching for changes + 1 changesets found + + displaying test ... + Content-Type: multipart/mixed; boundary="===*==" (glob) + MIME-Version: 1.0 + Subject: test + Message-Id: (glob) + User-Agent: Mercurial-patchbomb/* (glob) + Date: Thu, 01 Jan 1970 00:03:00 +0000 + From: quux + To: foo + Cc: bar + + --===*= (glob) + Content-Type: text/plain; charset="us-ascii" + MIME-Version: 1.0 + Content-Transfer-Encoding: 7bit + + a multiline + + description + + --===*= (glob) + Content-Type: application/x-mercurial-bundle + MIME-Version: 1.0 + Content-Disposition: attachment; filename="bundle.hg" + Content-Transfer-Encoding: base64 + + SEcxMEdaeJxjYGBY8V9n/iLGbtFfJZuNk/euDCpWfrRy/vTrevFCx1/4t7J5LdeL0ix0Opx3kwEL + wKYXKqUJwqnG5sYWSWmmJsaWlqYWaRaWJpaWiWamZpYWRgZGxolJiabmSQbmZqlcQMV6QGwCxGzG + CgZcySARUyA2A2LGZKiZ3Y+Lu786z4z4MWXmsrAZCsqrl1az5y21PMcjpbThzWeXGT+/nutbmvvz + zXYS3BoGxdrJDIYmlimJJiZpRokmqYYmaSYWFknmSSkmhqbmliamiZYWxuYmBhbJBgZcUBNZQe5K + Epm7xF/LT+RLx/a9juFTomaYO/Rgsx4rwBN+IMCUDLOKAQBrsmti + --===============*==-- (glob) + utf-8 patch: $ $PYTHON -c 'fp = open("utf", "wb"); fp.write("h\xC3\xB6mma!\n"); fp.close();' $ hg commit -A -d '4 0' -m 'utf-8 content'