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

[PATCH] issue #890: Implementation of Custom keywords

From: Kimitake <kimitake_at_gmail.com>
Date: Mon, 20 Oct 2008 06:25:48 -0700

Hi subversion developers,

I just modified subst.c to support redefine keyword feature like GNU CVS.
To use this, add the following to property.

NetBSD=Id

This example is for NetBSD project, so $NetBSD$ keyword is replaced like
$Id$ one.

I have submitted this before, but recreated it with trunk.

Regards,
Kimitake

Index: subversion/libsvn_subr/subst.c
===================================================================
--- subversion/libsvn_subr/subst.c (revision 33771)
+++ subversion/libsvn_subr/subst.c (working copy)
@@ -396,7 +396,17 @@
   for (i = 0; i < keyword_tokens->nelts; ++i)
     {
       const char *keyword = APR_ARRAY_IDX(keyword_tokens, i, const char *);
+ const char *replaced_word = keyword;
+ apr_array_header_t *keyword_tokens2;
+ keyword_tokens2 = svn_cstring_split(keyword, "=", TRUE /* chop */,
pool);
+
+ if (keyword_tokens2->nelts==2)
+ {
+ keyword = APR_ARRAY_IDX(keyword_tokens2, 1, const char*);
+ replaced_word = APR_ARRAY_IDX(keyword_tokens2, 0, const char*);
+ }
+
       if ((! strcmp(keyword, SVN_KEYWORD_REVISION_LONG))
           || (! strcmp(keyword, SVN_KEYWORD_REVISION_MEDIUM))
           || (! svn_cstring_casecmp(keyword, SVN_KEYWORD_REVISION_SHORT)))
@@ -450,7 +460,7 @@
           id_val = keyword_printf("%b %r %d %a", rev, url, date, author,
                                   pool);
- apr_hash_set(*kw, SVN_KEYWORD_ID,
+ apr_hash_set(*kw, replaced_word,
                        APR_HASH_KEY_STRING, id_val);
         }
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-10-20 15:26:07 CEST

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.