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

Re: automatic properties

From: B. W. Fitzpatrick <fitz_at_red-bean.com>
Date: 2003-08-22 05:13:53 CEST

Philip Martin <philip@codematters.co.uk> writes:
> Martin Furter <mf@rola.ch> writes:
>
> > I made a little patch which adds a new feature: automatic adding of
> > properties when adding files.
>
> I like this idea in general, but I think it has some problems.
>
> > Attached is a patch for subversion/libsvn_client/add.c
>
> Please include a log message when you send a patch, see the HACKING
> file.
>
> > After adding the patch you can define a new section in
> > ~/.subversion/config and add entries describing the properties.
> >
> > There are 3 types of entries: exact matches, suffix matches and the
> > default.
> > Exact matches have the highest priority, the default match the lowest. The
> > longer a suffix match is the higher it's priority.
>
> I see you are implementing the pattern matching manually. Did you
> choose the above rules because they were simple to implement? Are you
> aware of apr_fnmatch, as used in svn_string.c? I think I'd prefer an
> ordered list, with full apr_fnmatch pattern matching, where the first
> list element to match is used. However, I'm not sure if the current
> config file mechanism supports such an ordered list.
>
> > Here is an example config:
> >
> > [auto-props]
> > * = svn:executable
> > *.txt = svn:eol-style=native
> > *.old.txt =
> > *.sh = svn:eol-style=LF;svn:executable
> > README.old.txt = svn:eol-style=CRLF
> > Makefile = svn:eol-style=LF
>
> Users are going to want to use this feature to set svn:ignore, but it
> doesn't look like that will work since svn:ignore generally has a
> multi-line value. I suppose a space separated list could be used
> above (like global-ignores), but then the code is going to have to
> convert spaces into newlines for this particular "magic" property.

If the config parser works like ConfigParser in python (and it
should), the value of the key is the value of all characters*
up until the next line that begins with a non-whitespace character:

--------------------8-<-------cut-here---------8-<-----------------------
$ cat spike.py
#!/usr/bin/env python2.2

import ConfigParser

config = ConfigParser.ConfigParser()
config.read('spike.conf')
print config.get('auto-props', '*.blah')

--------------------8-<-------cut-here---------8-<-----------------------
$ cat spike.conf

[auto-props]

*.blah: svn:ignore=foo
        bar
        baz

--------------------8-<-------cut-here---------8-<-----------------------
$ ./spike.py
svn:ignore=foo
bar
baz

--------------------8-<-------cut-here---------8-<-----------------------

* The value itself is rstripped and leading whitespace on the multiple
  lines of the value is lstripped.

-Fitz

--
Brian W. Fitzpatrick    <fitz_at_red-bean.com>   http://www.red-bean.com/fitz/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Aug 22 05:14:45 2003

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.