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

[PATCH]: Transform rules prototype

From: Daniel Berlin <dberlin_at_dberlin.org>
Date: 2005-11-06 04:35:10 CET

This patch implements a prototype version of transform rules to save

After playing with this for a while, I really like it. However, i very
much would dislike the idea of trying to put these in dir properties,
and would rather see just a new syntax for using these or something.

To use it, apply the patch, then follow directions in config file setup
and read up on command line syntax:

Config file setup:

add a section to ~/.subversion/config named "[transform-rules]".

The syntax for each rule is "matchtext=replacement priority"

Replacement may contain $[1-9], which will be replaced with an argument,
if one is provided.

Priority specifies the order of rule application.

1 We have to have a priority explicit (IE order in file doesn't change
anything) unless we want to modify a bunch of config apis, or even the
prop apis, because they throw it all in a hash.
2. The same applies for using the match text as the lhs.

The other option is to require a bs name on the lhs.
like: rule1=<match text> <replacement> <priority>

or move priority there, so it's

<priority>=<match text> <replacement>

If you put the same name on the lhs, svn_config_* just store the last
value into the hash, as expected (since they have the same key).

Command line syntax:

In order to make this easy to test, i've hooked it up to the url syntax.

Url's starting with "rule://" will be tranformed according to the rules.

To specify an argument to a rule, use # to separate arguments
1. Argument text cannot contain /, in this url syntax, since doing so
would require adding an end argument delimiter.
2. The rule:// text is deleted as part of processing.
3. Where the occurrence of the text in the match part happens is of no
consequence (IE we don't require it occur right after a / or anything).
This would be easy to change
4. Each rule is applied exactly once per url, to the first match it
finds. This would be easy to change.


repo=svn://gcc.gnu.org/svn/gcc 3
branches=repo/branches 2
release=branches/gcc-$1-branch 1

The command line:
svn ls rule://repo

will be turned into

svn ls svn://gcc.gnu.org/svn/gcc

The command line
svn ls rule://release#4_0/gcc/ChangeLog

will become:
svn ls svn://gcc.gnu.org/svn/gcc/branches/gcc-4_0-branch/gcc/ChangeLog

(Note the recursive rule expansion, which happened in order of priority)

I am not formally proposing we use the rule:// syntax, it's just a way
to play with this.

(Though i'm not opposed to it if people like it :P).

Anyway, give this a try and tell me what you think.
It seems to save me a lot of typing, with very little setup.

I have no plans to implement Perl style matching and substitution, as
we'd have to import a real library to do that (and POSIX regular
expression syntax sucks rocks, IIRC:P)


To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Received on Sun Nov 6 04:36:13 2005

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