[PATCH] patchbomb: treat address of "none" as no addresses

Bryan O'Sullivan bos at serpentine.com
Tue Jan 5 05:56:17 UTC 2016


# HG changeset patch
# User Bryan O'Sullivan <bos at serpentine.com>
# Date 1451973286 28800
#      Mon Jan 04 21:54:46 2016 -0800
# Node ID 5f9f47b07d59c1c86936e4e4bdb8764f7ce3b9b0
# Parent  09ce74e1f92f8838bbcd2ac1309519f0448ffbed
patchbomb: treat address of "none" as no addresses

Previously it wasn't possible to use configuration to avoid
being prompted for e.g. a CC list when using patchbomb to send
emails.

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -35,7 +35,14 @@ configuration file::
 Use ``[patchbomb]`` as configuration section name if you need to
 override global ``[email]`` address settings.
 
-Then you can use the :hg:`email` command to mail a series of
+To indicate no email addresses in the ``to`` or ``cc`` field, use
+``none``::
+
+  [email]
+  to = some-list at example.org
+  cc = none
+
+Once configured, use the :hg:`email` command to mail a series of
 changesets as a patchbomb.
 
 You can also either configure the method option in the email section
@@ -55,6 +62,7 @@ overwritten by command line flags like -
 
 You can set patchbomb to always ask for confirmation by setting
 ``patchbomb.confirm`` to true.
+
 '''
 
 import os, errno, socket, tempfile, cStringIO
@@ -600,6 +608,8 @@ def email(ui, repo, *revs, **opts):
                 '')
         if not addr and ask:
             addr = prompt(ui, header, default=default)
+        if addr.lower() == 'none':
+            return ''
         if addr:
             showaddrs.append('%s: %s' % (header, addr))
             return mail.addrlistencode(ui, [addr], _charsets, opts.get('test'))


More information about the Mercurial-devel mailing list