Concept of the day: filesets?

Matt Mackall mpm at selenic.com
Wed Nov 17 13:27:52 CST 2010


On Wed, 2010-11-17 at 15:40 +0900, Nicolas Dumazet wrote:
> 2010/11/17 Matt Mackall <mpm at selenic.com>:
> > What if we applied the revset query language concept to file patterns?
> >
> > We have long had the ability to do:
> >
> >  hg ci "re:(foo|bar).*"
> >
> > We can specify re/glob/path just about wherever filenames are taken. If
> > we add a new set type, we can now do:
> >
> >  hg ci "set: modified() and contains('mpm') and exec() and not glob('**.py')"
> 
> I'm afraid of duplication:
> 
> find -not -name "*.py" -executable | xargs grep -l mpm | xargs hg st
> -mn | xargs hg ci

That'll work right up until I change the predicate to "not modified()"
or make it "or contains('mpm')", etc. Yes, you can be extra clever and
work around such bumps, but it's not hard to see that this quickly gets
into experts-only territory.

I'm surprised you can't look over at revsets and think "wow, that really
is amazingly powerful and useful, and doing that sort of thing with
files would probably also be quite useful." Yes, I could in fact do just
about everything revsets does with a hairy pipeline of log -q and uniq
commands, but it wouldn't exactly be convenient.

> In reality, I feel that it would take us away from the "There should
> be one-- and preferably only one --obvious way to do it."

xargs is the obvious way to maybe 5% of users.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list