aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2022-07-20 16:30:16 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2022-07-20 16:30:16 -0400
commitc3405761fafed6a08824297e8792391857452bb2 (patch)
tree4541977a2d47745ed27a0f533468a6e88a7cd8e2
parente2b6fe0a2288c1c79e5d4f0d8b48d86b81d5b31f (diff)
downloadb4-c3405761fafed6a08824297e8792391857452bb2.tar.gz
ez-send: give ability to bail out before sending
Just in case something got screwed up, give folks an overview of what will be sent and ability to bail out before sending things off. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/ez.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/b4/ez.py b/b4/ez.py
index f0b8f40..cec3a10 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -657,6 +657,15 @@ def get_series_details(start_commit: str) -> Tuple[str, str, str]:
return base_commit, shortlog.rstrip(), diffstat.rstrip()
+def print_pretty_addrs(addrs: list, hdrname: str) -> None:
+ if len(addrs) < 1:
+ return
+ logger.info('%s: %s', hdrname, b4.format_addrs([addrs[0]]))
+ if len(addrs) > 1:
+ for addr in addrs:
+ logger.info(' %s', b4.format_addrs([addr]))
+
+
def cmd_ez_send(cmdargs: argparse.Namespace) -> None:
# Check if the cover letter has 'EDITME' in it
cover, tracking = load_cover(strip_comments=True)
@@ -851,9 +860,27 @@ def cmd_ez_send(cmdargs: argparse.Namespace) -> None:
logger.info(' %s', filen)
return
+ # Give the user the last opportunity to bail out
+ if not cmdargs.dryrun:
+ logger.info('Will send the following messages:')
+ logger.info('---')
+ print_pretty_addrs(allto, 'To')
+ print_pretty_addrs(allcc, 'Cc')
+ logger.info('---')
+ for commit, msg in patches:
+ if not msg:
+ continue
+ logger.info(msg.get('Subject'))
+ logger.info('---')
+ try:
+ input('Press Enter to send or Ctrl-C to abort')
+ except KeyboardInterrupt:
+ logger.info('')
+ sys.exit(130)
+
# And now we go through each message to set addressees and send them off
sign = True
- if cmdargs.no_sign or config.get('submit-no-sign', '').lower() in {'yes', 'true', 'y'}:
+ if cmdargs.no_sign or config.get('ez-send-no-sign', '').lower() in {'yes', 'true', 'y'}:
sign = False
identity = config.get('sendemail-identity')
try: