[PATCH] patchbomb: don't prompt for cc when cc is set without value (update)

Christian Ebert blacktrash at gmx.net
Fri Jan 22 11:05:27 CST 2010


Hello,

This patch takes care of the patchbomb config section too.

Problem: it introduces a config boolean by the backdoor.

Alternatives that entail a behaviour change:

1) Make Cc behave like Bcc: No Cc prompt at all, Cc only
   configurable via hgrc.

   Tersest, but maybe cleanest solution.

2) Prompt for To *and* Cc when no To is given on command-line
   or configured.

   Sugar: when in prompt mode, configured Cc is presented at the
   prompt; possibly throw in some readline.

c


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1264179133 -3600
# Node ID 8c3a7a6cbe7d4882872db0a9315282fbd59328ac
# Parent  e898bc7810ad08affd99d4420c89165252db194c
patchbomb: don't prompt for cc when cc is set without value

diff --git a/doc/hgrc.5.txt b/doc/hgrc.5.txt
--- a/doc/hgrc.5.txt
+++ b/doc/hgrc.5.txt
@@ -302,7 +302,8 @@
     Optional. Comma-separated list of recipients' email addresses.
 ``cc``
     Optional. Comma-separated list of carbon copy recipients'
-    email addresses.
+    email addresses. The prompt for carbon copy recipients can be
+    turned off by setting this option without value.
 ``bcc``
     Optional. Comma-separated list of blind carbon copy recipients'
     email addresses. Cannot be set interactively.
diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -385,7 +385,10 @@
         if opts.get(opt):
             return mail.addrlistencode(ui, opts.get(opt), _charsets,
                                        opts.get('test'))
-
+        # do not prompt for Cc when it is configured explicitly empty
+        if (opt == 'cc' and (ui.config('email', opt) == '' or
+                             ui.config('patchbomb', opt == ''))):
+            prpt = None
         addrs = (ui.config('email', opt) or
                  ui.config('patchbomb', opt) or '')
         if not addrs and prpt:


More information about the Mercurial-devel mailing list