[PATCH 4 of 9] grep: add -e option for specifying multiple patterns

Idan Kamara idankk86 at gmail.com
Mon Oct 15 03:03:16 CDT 2012


On Sun, Oct 14, 2012 at 11:13 PM, Pierre-Yves David <
pierre-yves.david at ens-lyon.org> wrote:
>
>
> On 14 oct. 2012, at 22:54, Idan Kamara wrote:
>
> > # HG changeset patch
> > # User Idan Kamara <idankk86 at gmail.com>
> > # Date 1350073273 -7200
> > # Node ID 06edbeb509881597122b46de831da4332076c4a1
> > # Parent  806bab6620c0308b61a4cf9c0e95927650ccb513
> > grep: add -e option for specifying multiple patterns
>
> Why do we need that ?
>
> > diff --git a/mercurial/commands.py b/mercurial/commands.py
> > --- a/mercurial/commands.py
> > +++ b/mercurial/commands.py
> > @@ -2885,12 +2885,15 @@
> > +    ('e', 'regexp', [],
> > +     _('use this pattern to find matches (must be used if a pattern'
> > +       ' starts with -), multiple patterns are or-ed'), _('PATTERN')),
>
> We already have the "--" idioms to handle patterns that match with "-"
>
>   hg grep -- -babar

Slipped my mind that you can do this, I guess the help string should
be modified slightly then.

>
> And we already have "|" in regexp to specify multiple or-ed pattern
>
>   hg grep babar|celestine
>
> what does this -E birng new ? why is it necessary

Yeah you can use | right now but as someone used to regular grep
options I was missing the -e option.

I wonder if making one big regexp joined by | will process faster than
what I did though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20121015/fb9f8e29/attachment.html>


More information about the Mercurial-devel mailing list