hg grep users, feedback wanted
Matt Mackall
mpm at selenic.com
Tue May 18 16:08:21 UTC 2010
On Tue, 2010-05-18 at 17:35 +0200, Masklinn wrote:
> On 2010-05-18, at 17:25 , Steve Borho wrote:
> > We're contemplating some breaking changes to the 'hg grep' command for
> > the next release and would like some feedback from people who use 'hg
> > grep' or tried it and gave up on it long ago.
> >
> > Current behavior:
> >
> > 'hg grep -r N:M foo' walks changesets from N to M, looking at files
> > modified at each revision, and reports the first match it finds in
> > each file. 'hg grep -rN foo' is a subset that only looks at the files
> > modified at revision N. 'hg grep foo' is equivalent to 'hg grep -r
> > tip:null foo' (yes, that's why it's so slow).
> >
> > Proposed change:
> >
> > 'hg grep foo' will scan the working copy for matches (10x faster than
> > current behavior)
> I really don't see the point of that one. If I want to grep the working
> copy I have `grep` (or even better, `ack`).
To do this right, you need to do:
hg manifest | xargs grep
> As far as I'm concerned, hg grep is to find something I've lost
> somewhere in my history, if it's already here I can trivially find it
> without needing hg to do so. That would make a "bare" invocation of
> hg grep pretty much useless.
>
> > 'hg grep -r N foo' will scan all files as they existed at revision N
> > (also 10x faster)
> So it wouldn't be restricted to only the files modified in N right?
>
> That's fine, but...
>
> > 'hg grep -r N:M foo' - stays the same
> Why wouldn't that one work the same as the previous one?
>
> Right now, -r N is an obvious (and sensible) subset of -r N:M
Actually, it's not.
$ hg grep -r 10000 scalable hg
$ hg cat -r 10000 hg | grep scalable
# mercurial - scalable distributed SCM
The current version of -r only reports matches in files that were
modified in rev 10000, whether the matches appeared in that revision or
not. So it's neither about the changeset state (what I think you'd
expect) as a whole nor strictly its delta.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list