[PATCH] patchbomb: accept default if it is empty string. This fixes Cc: prompt

Alexander Solovyov piranha at piranha.org.ua
Wed Oct 21 12:51:44 UTC 2009


# HG changeset patch
# User Alexander Solovyov <piranha at piranha.org.ua>
# Date 1256129499 -10800
# Node ID 47fd2f0a632d2fdda519ac96ff2bda19f3779d18
# Parent  0fedf8233b2191c63fac3c39305e06b18f0a60e0
patchbomb: accept default if it is empty string. This fixes Cc: prompt

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -76,9 +76,9 @@ from mercurial import cmdutil, commands,
 from mercurial.i18n import _
 from mercurial.node import bin
 
-def prompt(ui, prompt, default='', rest=': ', empty_ok=False):
+def prompt(ui, prompt, default=None, rest=': ', empty_ok=False):
     if not ui.interactive():
-        if default or empty_ok:
+        if default is not None or empty_ok:
             return default
         raise util.Abort(_("%sPlease enter a valid value" % (prompt+rest)))
     if default:
@@ -380,7 +380,7 @@ def patchbomb(ui, repo, *revs, **opts):
     else:
         msgs = getpatchmsgs(list(getpatches(revs)))
 
-    def getaddrs(opt, prpt, default = None):
+    def getaddrs(opt, prpt, default=None):
         addrs = opts.get(opt) or (ui.config('email', opt) or
                                   ui.config('patchbomb', opt) or
                                   prompt(ui, prpt, default)).split(',')



More information about the Mercurial-devel mailing list