[PATCH RFC] changectx: introduce a grep method

Steve Borho steve at borho.org
Fri May 14 10:03:44 CDT 2010


On Fri, May 14, 2010 at 3:50 AM, Gilles Moris <gilles.moris at free.fr> wrote:
> On Friday 14 May 2010 09:27:41 am Dirkjan Ochtman wrote:
>> On Fri, May 14, 2010 at 06:54, Steve Borho <steve at borho.org> wrote:
>> > # HG changeset patch
>> > # User Steve Borho <steve at borho.org>
>> > # Date 1273812860 18000
>> > # Node ID cdb4143244b9499144d0a5addfdbc90c2ee75512
>> > # Parent  06586648eeec7aea123aa74d003ed14ed2891a43
>> > changectx: introduce a grep method
>> >
>> > Works for both a changectx and a workingctx.  Could be hooked into 'hg
>> > grep -c' or some other argument.  Looking for comments about the style
>> > and function.
>>
>> I wouldn't want to add this if we don't have any users of the API
>> (unless you can make a convincing case about needing it in other
>> places, of course). It seems rather niche.

This probably should go in cmdutil or within the grep command itself.
I also think the function should take a matcher to support -I/-X
arguments.

> I think "hg grep -c" would be a quite valid use case.
> I don't think we have a way with 'hg grep' to find if a string is in a
> branch, -r is just narrowing the revision search range. Currently, the
> workaround is to perform a checkout of the branch and using the shell grep.
>
> So yes, I would be +1 on "hg grep -c". And this behavior is probably closer to
> the user's expectation, than the current output which is quite linked to the
> internal implementation (i.e. basically linked to filerev).

Yes, the current default behavior is not very useful, and too slow.  I
think my manifest scan version should be used if the user has not
specified any of the options that require per-line annotation.

--
Steve Borho


More information about the Mercurial-devel mailing list