patchbomb: Don't prompt for headers until sure we have revs to export.
authorBryan O'Sullivan <bos@serpentine.com>
Sun, 27 May 2007 13:29:04 -0700
changeset 4485 82bc6aef8b43
parent 4438 3900f684a150
child 4486 6b84c8d2f66f
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.
hgext/patchbomb.py
--- a/hgext/patchbomb.py	Thu May 17 09:29:30 2007 -0700
+++ b/hgext/patchbomb.py	Sun May 27 13:29:04 2007 -0700
@@ -250,23 +250,6 @@
     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 @@
     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']: