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

Benoit Boissinot benoit.boissinot at ens-lyon.org
Wed Oct 21 14:04:35 UTC 2009


On Wed, Oct 21, 2009 at 03:51:44PM +0300, Alexander Solovyov wrote:
> # 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:

Then just remove the empty_ok stuff, we are basically doing empty_ok
with (default is not None).

>              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):

separate patch?

thanks,

Benoit

-- 
:wq



More information about the Mercurial-devel mailing list