Concept of the day: filesets?
Matt Mackall
mpm at selenic.com
Tue Nov 16 13:53:14 CST 2010
On Tue, 2010-11-16 at 13:38 -0600, Kevin Bullock wrote:
> On Nov 16, 2010, at 1:15 PM, Matt Mackall wrote:
>
> > 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 love this idea.
>
> > Want to check in only files not in a subrepo?
> >
> > hg ci "set: not subrepo()"
>
> The subrepo() predicate would presumably match .hgsub and .hgsubstate as well?
>
> Brainstorming predicates/functions:
>
> Basic status: added(), modified(), deleted(), removed(), ignored(), unknown(), clean()
> Extended status: copied(), renamed()
> Merge status: unresolved(), resolved()
> Paths: glob(str), re(str)
> Contents: contains(str/regex?)
> Metadata: user(str) [modified by user]
find(1) (the classic implementation of predicate matching on files)
knows about these:
tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N
-cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME
-ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN
-links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
-nouser -nogroup -path PATTERN -perm [+-]MODE -regex PATTERN
-readable -writable -executable
-wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N
-used N -user NAME -xtype [bcdpfls]
We probably don't want all of those, but a few are interesting.
Also, we'll want a syntax to let us include file lists/patterns from
other sources, for instance:
set:include(files.lst)
> What about making at least some predicates take revsets too? So you could do:
>
> hg log 'added(date(2010-01-01 to 2010-02-01))'
Reasonable concept. But you'll still need the set: prefix. I'll note
that some revset operators already take filespecs, so this would be
mutually recursive.
> First commands I would expect to take these filesets: st, log, ci, and
> anything that takes -X and -I... I'm sure there's others to add to
> that list.
Anything that uses match objects (just about everything) would get
support for these automatically.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list