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

Re: Custom Keywords (1.1-consider )

From: John Peacock <jpeacock_at_rowman.com>
Date: 2004-06-16 05:12:44 CEST

Greg Hudson wrote:
> Sorry it's taken so long for anyone to review this work.
>

That's fine, I've been busy too!

>
> It seems like your patch does more than this; it adds an (undocumented)
> props parameter to svn_subst_build_keywords2,

See this:

+/** Given a printf-like format string, return a string with proper
+ * information filled in.
+ *
+ * The codes of format:
+ *
+ * %a author of this revision
+ * %b basename of the URL of this file
+ * %d short format of date of this revision
+ * %D long format of date of this revision
+ * %p property value
+ * %r number of this revision
+ * %u URL of this file
+ *
+ * All memory is allocated out of @a pool.
+ */

I know it's not much in the way of documentation, but it is there.

> and it introduces a
> keyword_printf framework replacing the hardcoded keyword constructions
> in the old svn_subst_build_keywords.

Well, duh, that was the point of the exercise after all. ;)

The printf() style formatting of keywords was to allow custom keywords to built
up out of the primitives (see the definition of SVN_KEYWORD_ID_FORMAT in
particular). One new primitives which plasma introduced was %p for including
properties as a possible element to be expanded.

>
> It appears that the proper API of svn_subst_build_keywords2 is going to
> depend on the eventual nature of our custom keyword support. I don't
> remember seeing, nor can I think up, any practical use cases for the
> idea of simply allowing properties to be used as keywords

Then you haven't been paying that close attention to the user list! <ouch>

My personal use case for properties as keywords is a Version property, that will
be substituted into $Version$ in the source (Perl in my case). Since, IMNSHO,
the $Revision$ keyword is almost completely useless on a human-readable level
for multi project repositories, this is my way of propagating a version number
into my source file.

I have hope that there will eventually be inheritable properties, in which case
I can set Version at the top level directory and all files will inherit it
automatically. I have a tool brewing in the back of my mind called 'release'
which will do roughly the following:

        $ make distclean
        $ perl Makefile.PL
        $ make && make test
        $ `magic script to locate the master $VERSION for the project and increment it
in the property of that file`
        $ make distclean
        $ perl Makefile.PL
        $ make tardist
        $ `submit to CPAN`

I'm not the only one who has wanted to do something similar, however. Off the
top of my head, I know that more than one person has asked about $Copyright$ and
I think there were a couple of people who wanted other similar boilerplate text
as keywords.

I've already got a third patch (which goes along with the other two in the
issue), which adds generic property as keyword (with tests even!), but since it
has to limit keyword expansion to a single line (and SVN_KEYWORD_MAX_LEN
characters) I am having a conceptual problem figuring out how to throw a warning
from inside lib_subst...

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jun 16 05:13:04 2004

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.