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

Re: Regular expressions in Subversion

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Wed, 17 Oct 2012 20:32:18 +0200

On 17.10.2012 20:17, Stefan Sperling wrote:
> On Wed, Oct 17, 2012 at 12:20:20PM -0400, Hyrum K Wright wrote:
>> There are several places where regular expressions would be useful in
>> Subversion. Off hand, the new log --search feature and svn:ignore
>> properties feel like they'd be use candidates for regexs, and they
>> could probably also apply to authz rules eventually. I'm sure there
>> are more.
>
> How do we change existing features from glob syntax to regex without
> breaking compatibility? A glob pattern can of course be expressed in
> regex syntax, but the syntax isn't equivalent. Can we reliably detect
> whether a given pattern (say, on a line within svn:ignore) is a glob
> pattern or a regex?
>
> For instance, what about "a*.txt"? In glob this means: starts with 'a',
> followed by any amount of characters, and ends with '.txt'. But in regex
> it means: starts with any number of 'a' characters (including zero), and
> ends with '.txt'.
>
> $ ls *.txt | egrep 'a*.txt'
> a.txt
> aaa.txt
> bbb.txt
> foo.txt
> $ ls a*.txt | egrep 'a*.txt'
> a.txt
> aaa.txt
> $
>
> (where ls uses glob syntax and egrep uses regex)

In such situations, to keep the compatibility, why not just introduce a
new property, e.g. 'svn:ignore-regex' which if set takes precedence over
the 'svn:ignore' property?

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net
Received on 2012-10-17 20:32:57 CEST

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