# http://people.freebsd.org/~peter/svn_customid1.diff # # This patch is a modification of patch in issue #860. # Instead of aliasing one keyword to another, and a big bug (only # supports aliasing to $Id$ anyway), this version allows # keyword_printf() format strings. # svn propset svn:keywords 'Foo=%b Bar=%r' file (expands $Foo: filename $, etc) # %I is an alias for $id$-like expansion. I've added %_ to insert a space. # eg: 'CustomId=%b%_Some%_Random%_String'. The svn:keywords parser doesn't # allow plain spaces. # # svn_customid2.diff is a full superset, and adds %P ($CVSHeader-like path) # Index: subversion/libsvn_subr/subst.c =================================================================== --- subversion/libsvn_subr/subst.c (revision 30712) +++ subversion/libsvn_subr/subst.c (working copy) @@ -257,6 +278,9 @@ if (url) svn_stringbuf_appendcstr(value, url); break; + case '_': /* '%_' => a space */ + svn_stringbuf_appendbytes(value, " ", 1); + break; case '%': /* '%%' => a literal % */ svn_stringbuf_appendbytes(value, cur, 1); break; @@ -397,13 +436,30 @@ { const char *keyword = APR_ARRAY_IDX(keyword_tokens, i, const char *); + apr_array_header_t *keyword_tokens2; + keyword_tokens2 = svn_cstring_split(keyword, "=", TRUE /* chop */, pool); + + if (keyword_tokens2->nelts == 2) + { + svn_string_t *custom_val; + const char *custom_expand; + + keyword = APR_ARRAY_IDX(keyword_tokens2, 0, const char*); + custom_expand = APR_ARRAY_IDX(keyword_tokens2, 1, const char*); + if (! strcmp(custom_expand, "%I")) + custom_expand = "%b %r %d %a"; + custom_val = keyword_printf(custom_expand, rev, url, date, author, pool); + apr_hash_set(*kw, keyword, APR_HASH_KEY_STRING, custom_val); + return SVN_NO_ERROR; + } + if ((! strcmp(keyword, SVN_KEYWORD_REVISION_LONG)) || (! strcmp(keyword, SVN_KEYWORD_REVISION_MEDIUM)) || (! svn_cstring_casecmp(keyword, SVN_KEYWORD_REVISION_SHORT))) { svn_string_t *revision_val; revision_val = keyword_printf("%r", rev, url, date, author, pool); apr_hash_set(*kw, SVN_KEYWORD_REVISION_LONG, APR_HASH_KEY_STRING, revision_val); apr_hash_set(*kw, SVN_KEYWORD_REVISION_MEDIUM,