# HG changeset patch # User Bryan O'Sullivan # Date 1180297744 25200 # Node ID 82bc6aef8b433f39c9bdc02f65b0ef07ac77cacd # Parent 3900f684a150ba9a847c499dd7bf6bf139070866 patchbomb: Don't prompt for headers until sure we have revs to export. The prior behaviour was to always prompt for headers, and only then bomb out if there were actually no revs to send. diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -250,23 +250,6 @@ def patchbomb(ui, repo, *revs, **opts): def genmsgid(id): return '<%s.%s@%s>' % (id[:20], int(start_time[0]), socket.getfqdn()) - sender = (opts['from'] or ui.config('email', 'from') or - ui.config('patchbomb', 'from') or - prompt('From', ui.username())) - - def getaddrs(opt, prpt, default = None): - addrs = opts[opt] or (ui.config('email', opt) or - ui.config('patchbomb', opt) or - prompt(prpt, default = default)).split(',') - return [a.strip() for a in addrs if a.strip()] - - to = getaddrs('to', 'To') - cc = getaddrs('cc', 'Cc', '') - - bcc = opts['bcc'] or (ui.config('email', 'bcc') or - ui.config('patchbomb', 'bcc') or '').split(',') - bcc = [a.strip() for a in bcc if a.strip()] - def getexportmsgs(): patches = [] @@ -344,6 +327,23 @@ def patchbomb(ui, repo, *revs, **opts): else: msgs = getexportmsgs() + sender = (opts['from'] or ui.config('email', 'from') or + ui.config('patchbomb', 'from') or + prompt('From', ui.username())) + + def getaddrs(opt, prpt, default = None): + addrs = opts[opt] or (ui.config('email', opt) or + ui.config('patchbomb', opt) or + prompt(prpt, default = default)).split(',') + return [a.strip() for a in addrs if a.strip()] + + to = getaddrs('to', 'To') + cc = getaddrs('cc', 'Cc', '') + + bcc = opts['bcc'] or (ui.config('email', 'bcc') or + ui.config('patchbomb', 'bcc') or '').split(',') + bcc = [a.strip() for a in bcc if a.strip()] + ui.write('\n') if not opts['test'] and not opts['mbox']: