# HG changeset patch # User Christian Ebert # Date 2010-09-10 13:32:22 # Node ID 5bfa45651cf674d851522a0dba7293488b3bf6e0 # Parent aebb39d45500d0b3d1bf7e8ca9c369e32234c6dd patchbomb: add --confirm option to show series details and ask for confirmation --confirm presents same prompt as --diffstat, but does not write a diffstat to the messages' bodies. A simple test simulating a negative response is included. diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -22,9 +22,9 @@ Each message refers to the first in the and References headers, so they will show up as a sequence in threaded mail and news readers, and in mail archives. -With the -d/--diffstat option, you will be presented with a final -summary of all messages and asked for confirmation before the messages -are sent. +With the -d/--diffstat or -c/--confirm options, you will be presented +with a final summary of all messages and asked for confirmation before +the messages are sent. To configure other defaults, add a section like this to your hgrc file:: @@ -412,7 +412,7 @@ def patchbomb(ui, repo, *revs, **opts): bcc = getaddrs('bcc') replyto = getaddrs('reply-to') - if opts.get('diffstat'): + if opts.get('diffstat') or opts.get('confirm'): ui.write(_('\nFinal summary:\n\n')) ui.write('From: %s\n' % sender) for addr in showaddrs: @@ -509,6 +509,7 @@ emailopts = [ ('i', 'inline', None, _('send patches as inline attachments')), ('', 'bcc', [], _('email addresses of blind carbon copy recipients')), ('c', 'cc', [], _('email addresses of copy recipients')), + ('', 'confirm', None, _('ask for confirmation before sending')), ('d', 'diffstat', None, _('add diffstat output to messages')), ('', 'date', '', _('use the given date as the sending date')), ('', 'desc', '', _('use the given file as the series description')), diff --git a/tests/test-patchbomb.t b/tests/test-patchbomb.t --- a/tests/test-patchbomb.t +++ b/tests/test-patchbomb.t @@ -46,6 +46,23 @@ +a + $ hg --config ui.interactive=1 email --confirm -n -f quux -t foo -c bar -r tip< n + > EOF + This patch series consists of 1 patches. + + + Final summary: + + From: quux + To: foo + Cc: bar + Subject: [PATCH] a + a | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + + are you sure you want to send (yn)? abort: patchbomb canceled + $ echo b > b $ hg commit -Amb -d '2 0' adding b