[PATCH] match: adding non-recursive directory matching

Augie Fackler raf at durin42.com
Mon Oct 17 20:25:31 EDT 2016


On Sun, Oct 16, 2016 at 03:50:10PM +0200, Pierre-Yves David wrote:
>
>
> On 10/08/2016 06:58 PM, Rodrigo Damazio Bovendorp via Mercurial-devel wrote:
> > # HG changeset patch
> > # User Rodrigo Damazio Bovendorp <rdamazio at google.com>
> > # Date 1475944120 25200
> > #      Sat Oct 08 09:28:40 2016 -0700
> > # Node ID 545efe5a72efdce925a6a3fd3774b350c90b5c55
> > # Parent  dbcef8918bbdd8a64d9f79a37bcfa284a26f3a39
> > match: adding non-recursive directory matching
> >
> > This allows one to match all files in a directory, without matching anything in subdirectories.
> > It's implemented almost identically to path:, except for the regex termination, which doesn't
> > allow more than one / after the directory name.
> >
> > diff --git a/mercurial/match.py b/mercurial/match.py
> > --- a/mercurial/match.py
> > +++ b/mercurial/match.py
> > @@ -105,6 +105,9 @@
> >          'glob:<glob>' - a glob relative to cwd
> >          're:<regexp>' - a regular expression
> >          'path:<path>' - a path relative to repository root
> > +        'files:<path>' - a path relative to repository root, which is matched
> > +                         non-recursively (files inside the directory will match,
> > +                         but subdirectories and files in them won't
>
> The feature seems useful and we should have it.
>
> The current behavior is a bit strange to me. because we have directory being
> implicitly recursed of just 1 level (directory content). Could we have a
> xxx:<path> where path is never recursed for anything. Listing a directory
> content would be an explicite 'xxx:my/directory/path/*'
>
> We could use 'exact' or 'norecursion' for xxx.

exact: works for me. I think norecusion: is too long, since users will
need to type this.


More information about the Mercurial-devel mailing list