[PATCH] log: fix broken multiple user search [2]

Martin Geisler mg at daimi.au.dk
Tue Apr 7 13:12:39 CDT 2009


Henrik Stuart <hg at hstuart.dk> writes:

> # HG changeset patch
> # User Henrik Stuart <hg at hstuart.dk>
> # Date 1239126829 -7200
> # Node ID 601761c464f3a854a549b758ab45a6c71568eef9
> # Parent  8985e1daa7f58ecbae00b601bd3b9e9d6cc2051e
> log: fix broken multiple user search
>
> This fix also allows partial user matches so the full name and email does not have to be written out in verbatim.

Please word-wrap the commit message at 70 characters.

> diff -r 8985e1daa7f5 -r 601761c464f3 mercurial/commands.py
> --- a/mercurial/commands.py	Tue Apr 07 17:32:40 2009 +0200
> +++ b/mercurial/commands.py	Tue Apr 07 19:53:49 2009 +0200
> @@ -1963,12 +1963,7 @@
>  
>              if opts['user']:
>                  changes = get(rev)
> -                miss = 0
> -                for k in opts['user']:
> -                    if k != changes[1]:
> -                        miss = 1
> -                        break
> -                if miss:
> +                if not any([True for k in opts['user'] if k in changes[1]]):

The any built-in was introduced in Python 2.5, but Mercurial supports
Python 2.4. Here I believe you could simply leave it out since:

  any([True for k in seq]) == len(seq) > 1 == bool(seq)

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090407/5281db10/attachment.pgp 


More information about the Mercurial-devel mailing list