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

svn:keywords ... a plea

From: Graeme Vetterlein <graeme_at_vetterlein.com>
Date: Mon, 24 Mar 2008 21:31:22 +0000

OK, I've finally worked up enough enthusiasm to
put this down in text. (and register for mailing-list etc ...)

In case I get the mood wrong, this is a plea, not a rant. ... honest.

I guess I've been using Source code control systems on Unix type
platforms for 20-25 years. I've used SCCS, RCS, CVS, PCVS, Clearcase
and most recently SVN. I've used SVN at work for a couple of years and
I'm finally moving my home systems over to SVN.

One thing I've always impressed on people developing software is
VERSIONS:

    1: Make sure you have them
    2: Make sure people can identify them

For part2, I'm usually meaning things like -v (--version) and ident(1)
and what(1) strings. All these rely on version keywords. Simple:

    SCCS: static const char sccid[] = "%Z%%M% %I% %E%"

    RCS: static const char rcsid[] = "@(#)$Id:$";

    CVS: static const char cvsid[] = "@(#)$Id:$";
    + edit the file: $CVSROOT/CVSROOT/cvswrappers to ensure binary files
have -kb (to avoid keyword expansion)

    SVN: static const char svnid[] = "@(#)$Id:$";

Then either:
    for each file:
        svn propset svn:keywords "Date Author" weather.txt (from the
svnbook)

    ... but possibly you meant:

        svn propset svn:keywords "Id Date Author" weather.txt

    ... but more than once I've typed:

        svn propset svn:keywords Id,Date,Author weather.txt
        
    Which works (as in , does not fail) but of course totally fails
    to do the substitution.

    ... Or I might type:

        svn propset svn:keywords "id date author" weather.txt

    Again no error, but no substitution either.

    
So what do I find. Most (SVN) files do not have the keywords
substitution turned on. So when trouble hits and you type "ident
broken-prog" you get very little help back. Typically just the library
code that was in rcs or cvs.

So I decide. Enough is enough. I'm going to set the correct option of
the SVN repository I creating at home to ensure I (at least) don't
have this problem. I consult the svn book:

I read it and find:

    Auto-prop support is perhaps the handiest property related
    tool in the Subversion toolbox. See the section called
    "Config" for more about configuring that support.

...sounds good, so I follow on:

enable-auto-props

    This instructs Subversion to automatically set properties on
    newly added or imported files. The default value is no, so set
    this to yes to enable Auto-props. The auto-props section of
    this file specifies which properties are to be set on which
    files.

...not quite what I would like, but OK. bit like -kb in cvs wrappers
I'll just setup my repository to add this to all files. Can't seem to
find the right file, go back and re-read the section and discover this
is a CLIENT-SIDE config setting ...What! OK , get a grip, hard to work
out why a project specific setting should be governed by a config file
that depends on the (1st) user who updated the file?

I stay cool and read on:

The auto-props section controls the Subversion client's ability to
automatically set properties on files when they are added or
imported. It contains any number of key-value pairs in the format
PATTERN = PROPNAME=PROPVALUE where PATTERN is a file pattern that
matches a set of filenames and the rest of the line is the property
and its value. Multiple matches on a file will result in multiple
propsets for that file; however, there is no guarantee that auto-props
will be applied in the order in which they are listed in the config
file, so you can't have one rule "override" another. You can find
several examples of auto-props usage in the config file. Lastly, don't
forget to set enable-auto-props to yes in the miscellany section if
you want to enable auto-props.

So there is an "auto-props section" ... bound to be a description of
that in the book ... nope, never comes up again, I wonder what an
"auto-props" section looks like. Ahh there's the answer:

    "You can find several examples of auto-props usage in the
    config file"

... can you heck :-) There is no mention of the "auto-props section"
anywhere (that I can find) other than that lone paragraph in the
svn-book. Still know I know the magic keyword I can unleash google on
it. I discover the apache 'svn config file'

    http://cwiki.apache.org/GMOxDEV/subversion-client-configuration.html

Finally ... the answer!!

In summary:

    1: Adding keywords is (almost) always a GOOD IDEA ... just need to
take care in a few cases
    2: Getting keywords to work in most version control systems is simple
    3: In SVN it is very hard:
        i: Requires a special setting on each file
        ii: Setting is 'free format' so cannot be syntax checked by svn
        iii: Automatic setting of option cannot be done on repository
(i.e. project) basis
        iv: Setting of option on client side:
            a: Mostly missing from documentation
            b: Not given default values in generated files (like many
other options)
    4: Very few files I've found in SVN have the keywords set
(correctly) (this is MY experience ... many 10's of users)

This seems very like "Spoiling the ship for a hapenth of Tar".

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-03-24 22:31:36 CET

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

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