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.
--- 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']: