[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Glob syntax for svndumpfilter exclude --pattern

From: Julian Foad <julianfoad_at_apache.org>
Date: Mon, 20 Feb 2017 10:23:42 +0000

The '--pattern' option to svndumpfilter exclude/include was introduced
in Subversion 1.7 by http://svn.apache.org/r880381 (cc: Brane):

$ svndumpfilter --help exclude
   --pattern : Treat the path prefixes as file glob patterns.

We don't say what sort of glob patterns it accepts, even in the Book
[1]. In particular, for a customer's use case, I would like to know
whether it supports matching a variable number of path elements, for
which a '/**/' syntax is typically used.

Its implementation uses svn_cstring_match_glob_list() which doesn't say
either. The implementation of that uses apr_fnmatch(flags=0).

apr_fnmatch is documented. In particular it says '*' matches "Any
sequence of zero or more characters". (We are *not* giving the flag
APR_FNM_PATHNAME "Slash must be matched by slash".)

So the particular answer I was looking for is that '*' will cross
multiple path elements:

   $ svndumpfilter exclude --pattern '*/alpha'
   Excluding prefix patterns:
   Dropped 2 nodes:

(I noticed a suboptimal edge case: the above example doesn't match the
path '/alpha', because the implementation adds a leading slash to the
specified pattern, making '/*/alpha', and then insists on matching both
slashes literally.)

- Julian

Received on 2017-02-20 11:23:51 CET

This is an archived mail posted to the Subversion Dev mailing list.