On 10/18/2016 02:25 AM, Augie Fackler wrote:
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 <rdama...@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 
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 
+                         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.

What about my proposal of changing the semantic to be plain exact matching (no implicit matching of files in a matched directory) ?

That would move use to:

        'files:<path>' - a path relative to repository root, which is
                         matched non-recursively

  exact:foo → match a file 'foo',
  exact:foo/* → match content of 'foo' directory,
  exact:foo/** → match anything under 'foo',


Pierre-Yves David
Mercurial-devel mailing list

Reply via email to