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:
   '/*/alpha'
  [...]
  Dropped 2 nodes:
   '/foo/alpha'
   '/foo/bar/alpha'
]]]

(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


[1] http://svnbook.red-bean.com/nightly/en/svn.ref.svndumpfilter.html#svn.ref.svndumpfilter.sw.pattern

Reply via email to