git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: Dave Boutcher <daveboutcher@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/3] git-multimail: Add an option to filter on branches
Date: Wed, 22 Apr 2015 13:44:54 +0200	[thread overview]
Message-ID: <553789B6.7030501@alum.mit.edu> (raw)
In-Reply-To: <CAEXuECi=UDo7_0O22+Gi1yew1M=LrrKLXNT9gdSvdgQwCxYjow@mail.gmail.com>

On 04/22/2015 12:46 PM, Dave Boutcher wrote:
> The only code I'm not fond of is matching on a list of regular
> expressions.  There must be a more pythonic way to do:
> 
> + return [x for x in [r.match(branch) for r in branches] if x]
> 
> which basically returns true if "branch" matches any regular
> expression in the list.

I think what you are looking for is

    return any(r.match(branch) for r in branches)

This also has the advantage of stopping processing as soon as it finds a
match.

I was also wondering why you decided to support comma-separated lists of
regexps *and* multivalued config settings. It seems that supporting only
multivalued settings would suffice.

Maybe you are following the precedent of our email configuration
settings, which support comma-separated lists of email addresses? If so,
I don't think that is necessary. The email support is there for
backwards compatibility and because comma-separated email addresses are
a thing in RFC 2822. Neither of these arguments apply to branch regexps.

> I pushed this change out to our production git server (its good to be
> the king.)  I'll obviously update here if it does anything too
> unfortunate.

Thanks.

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu

  reply	other threads:[~2015-04-22 11:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21 23:04 [PATCH 1/3] git-multimail: Add an option to filter on branches Dave Boutcher
2015-04-21 23:04 ` [PATCH 2/3] git-multimail: Add a quiet option to prevent outputting email addresses from hook Dave Boutcher
2015-04-21 23:04 ` [PATCH 3/3] git-multimail: Add stdout option to config Dave Boutcher
2015-04-22 10:39 ` [PATCH 1/3] git-multimail: Add an option to filter on branches Michael Haggerty
2015-04-22 10:46   ` Dave Boutcher
2015-04-22 11:44     ` Michael Haggerty [this message]
2015-04-23  1:48       ` Dave Boutcher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=553789B6.7030501@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=daveboutcher@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).