[PATCH] patchbomb: fix address parsing, allow multiple addrs in --to/cc/bcc

Martin Geisler mg at lazybytes.net
Wed Nov 4 10:09:56 CST 2009


Marti Raudsepp <marti at juffo.org> writes:

> [...] instead of trying to extend this broken behavior, I will fix it.

That's an excellent move :-)

> For reference, here are the outputs of the new testcase: 
> hg email --date '1980-1-1 0:1' -m tmp.mbox -f quux -t 'spam<spam><eggs>' \
>  -t toast -c 'foo,bar at example.com' -c '"A, B <>" <a at example.com>' -s test -r 0 \
>  --config email.bcc='"Quux, A." <quux>'
>
> with patch:
>   To: spam <spam>, eggs, toast
>   Cc: foo, bar at example.com, "A, B <>" <a at example.com>
>   Bcc: "Quux, A." <quux>
>
> without patch:
>   To: spam <spam>, toast
>   Cc: foo, "A, B <>" <a at example.com>
>   Bcc: Quux, A.

Nice improvement!

> Should I split this patch in two? One to change mail.py, the other to
> implement this in patchbomb.py?

Yeah, that is a good idea.

> diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
> --- a/hgext/patchbomb.py
> +++ b/hgext/patchbomb.py
> @@ -379,20 +379,21 @@
>      else:
>          msgs = getpatchmsgs(list(getpatches(revs)))
>  
> -    def getaddrs(opt, prpt, default = None):
> +    def getaddrs(opt, prpt = None, default = None):

I know the old function did it wrong, but please write this as

    def getaddrs(opt, prpt=None, default=None):

as described in PEP8:

  http://www.python.org/dev/peps/pep-0008/

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.


More information about the Mercurial-devel mailing list