[PATCH 4 of 4] patchbomb: display recipients and ask for confirmation

Christian Ebert blacktrash at gmx.net
Tue Jan 26 14:25:33 CST 2010


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1264537263 0
# Node ID b4e58a3d470080d07ca5a57de750abcae2f0871d
# Parent  c08082a9b62eb39e408504b67a080db1d7da772e
patchbomb: display recipients and ask for confirmation

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -386,20 +386,25 @@
 
     def getaddrs(opt, prpt=None, default=None):
         if opts.get(opt):
+            ui.write('%s: %s\n' % (opt.capitalize(), ', '.join(opts.get(opt))))
             return mail.addrlistencode(ui, opts.get(opt), _charsets,
                                        opts.get('test'))
 
-        addrs = (ui.config('email', opt) or
-                 ui.config('patchbomb', opt) or '')
+        addrs = ui.config('email', opt) or ui.config('patchbomb', opt) or ''
         if not addrs and prpt:
             addrs = prompt(ui, prpt, default)
-
+        elif addrs:
+            ui.write('%s: %s\n' % (opt.capitalize(), addrs))
         return mail.addrlistencode(ui, [addrs], _charsets, opts.get('test'))
 
     to = getaddrs('to', 'To')
     cc = getaddrs('cc')
     bcc = getaddrs('bcc')
 
+    resp = ui.prompt(_('send patchbomb to the recipients listed above? [y]'))
+    if resp.lower() != 'y':
+        return
+
     ui.write('\n')
 
     parent = opts.get('in_reply_to') or None
diff --git a/tests/test-patchbomb.out b/tests/test-patchbomb.out
--- a/tests/test-patchbomb.out
+++ b/tests/test-patchbomb.out
@@ -1,6 +1,9 @@
 adding a
 This patch series consists of 1 patches.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH] a ...
 Content-Type: text/plain; charset="us-ascii"
@@ -34,6 +37,9 @@
 
 Write the introductory message for the patch series.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH 0 of 2] test ...
 Content-Type: text/plain; charset="us-ascii"
@@ -109,6 +115,9 @@
 
 Write the introductory message for the patch series.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Writing [PATCH 0 of 2] test ...
 Writing [PATCH 1 of 2] a ...
@@ -117,6 +126,9 @@
 % test bundle and description
 searching for changes
 1 changesets found
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying test ...
 Content-Type: multipart/mixed; boundary="===
@@ -157,10 +169,13 @@
 adding utf
 % no mime encoding for email --test
 % md5sum of 8-bit output
-e726c29b3008e77994c7572563e57c34  mailtest
+eebd314b04acc0a05959ce81f5d5ca1f  mailtest
 % mime encoded mbox (base64)
 This patch series consists of 1 patches.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Writing [PATCH] charset=utf-8; content-transfer-encoding: base64 ...
 From quux Thu Jan 01 00:04:01 1970
@@ -192,10 +207,13 @@
 adding qp
 % no mime encoding for email --test
 % md5sum of qp output
-0402c7d033e04044e423bb04816f9dae  mailtest
+b62abb03e63376528a599f66c731a3c4  mailtest
 % mime encoded mbox (quoted-printable)
 This patch series consists of 1 patches.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Writing [PATCH] charset=utf-8; content-transfer-encoding: quoted-printable ...
 From quux Thu Jan 01 00:04:01 1970
@@ -246,6 +264,9 @@
 % fake ascii mbox
 This patch series consists of 1 patches.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Writing [PATCH] charset=us-ascii; content-transfer-encoding: 8bit ...
 % md5sum of 8-bit output
@@ -258,6 +279,9 @@
  c |  1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH] test ...
 Content-Type: text/plain; charset="us-ascii"
@@ -311,6 +335,9 @@
 
 Write the introductory message for the patch series.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH 0 of 2] test ...
 Content-Type: text/plain; charset="us-ascii"
@@ -396,6 +423,9 @@
 % test inline for single patch
 This patch series consists of 1 patches.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH] test ...
 Content-Type: multipart/mixed; boundary="===
@@ -432,6 +462,9 @@
 % test inline for single patch (quoted-printable)
 This patch series consists of 1 patches.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH] test ...
 Content-Type: multipart/mixed; boundary="===
@@ -487,6 +520,9 @@
 
 Write the introductory message for the patch series.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH 0 of 3] test ...
 Content-Type: text/plain; charset="us-ascii"
@@ -623,6 +659,9 @@
 % test attach for single patch
 This patch series consists of 1 patches.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH] test ...
 Content-Type: multipart/mixed; boundary="===
@@ -668,6 +707,9 @@
 % test attach for single patch (quoted-printable)
 This patch series consists of 1 patches.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH] test ...
 Content-Type: multipart/mixed; boundary="===
@@ -732,6 +774,9 @@
 
 Write the introductory message for the patch series.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH 0 of 3] test ...
 Content-Type: text/plain; charset="us-ascii"
@@ -898,6 +943,9 @@
 
 Write the introductory message for the patch series.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH 0 of 1] test ...
 Content-Type: text/plain; charset="us-ascii"
@@ -946,6 +994,9 @@
 
 Write the introductory message for the patch series.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH 0 of 2] test ...
 Content-Type: text/plain; charset="us-ascii"
@@ -1020,6 +1071,9 @@
 % test inline for single named patch
 This patch series consists of 1 patches.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH] test ...
 Content-Type: multipart/mixed; boundary="===
@@ -1059,6 +1113,9 @@
 
 Write the introductory message for the patch series.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH 0 of 2] test ...
 Content-Type: text/plain; charset="us-ascii"
@@ -1144,6 +1201,9 @@
 % test inreplyto
 This patch series consists of 1 patches.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH] Added tag two, two.diff for changeset ff2c9fa2018b ...
 Content-Type: text/plain; charset="us-ascii"
@@ -1185,6 +1245,9 @@
 
 Write the introductory message for the patch series.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH 0 of 2] test ...
 Content-Type: text/plain; charset="us-ascii"
@@ -1260,6 +1323,9 @@
 % test single flag for single patch
 This patch series consists of 1 patches.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH fooFlag] test ...
 Content-Type: text/plain; charset="us-ascii"
@@ -1293,6 +1359,9 @@
 
 Write the introductory message for the patch series.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH 0 of 2 fooFlag] test ...
 Content-Type: text/plain; charset="us-ascii"
@@ -1366,6 +1435,9 @@
 % test mutiple flags for single patch
 This patch series consists of 1 patches.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH fooFlag barFlag] test ...
 Content-Type: text/plain; charset="us-ascii"
@@ -1399,6 +1471,9 @@
 
 Write the introductory message for the patch series.
 
+To: foo
+Cc: bar
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH 0 of 2 fooFlag barFlag] test ...
 Content-Type: text/plain; charset="us-ascii"
@@ -1472,6 +1547,10 @@
 % test multi-address parsing
 This patch series consists of 1 patches.
 
+To: spam<spam><eggs>, toast
+Cc: foo,bar at example.com, "A, B <>" <a at example.com>
+Bcc: "Quux, A." <quux>
+send patchbomb to the recipients listed above? [y] y
 
 Writing [PATCH] test ...
 From quux Tue Jan 01 00:01:01 1980
@@ -1505,6 +1584,8 @@
 % test multi-byte domain parsing
 This patch series consists of 1 patches.
 
+To: bar@ünicode.com
+send patchbomb to the recipients listed above? [y] y
 
 Writing [PATCH] test ...
 From quux Tue Jan 01 00:01:01 1980
@@ -1544,6 +1625,8 @@
 
 Write the introductory message for the patch series.
 
+To: foo
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH 0 of 8] test ...
 Content-Type: text/plain; charset="us-ascii"
@@ -1811,6 +1894,8 @@
 searching for changes
 This patch series consists of 1 patches.
 
+To: foo
+send patchbomb to the recipients listed above? [y] y
 
 Displaying [PATCH] test ...
 Content-Type: text/plain; charset="us-ascii"


More information about the Mercurial-devel mailing list