Author: svn-role
Date: Sat May 25 04:01:41 2013
New Revision: 1486285

URL: http://svn.apache.org/r1486285
Log:
Merge r1486072 from trunk:

 * r1486072
   Fix expansion of custom keywords with values that contain '='.
   Justification:
     Custom keyword values containing '=' should work.
   Votes:
     +1: stsp, danielsh, cmpilato

Modified:
    subversion/branches/1.8.x/   (props changed)
    subversion/branches/1.8.x/STATUS
    subversion/branches/1.8.x/subversion/libsvn_subr/subst.c
    
subversion/branches/1.8.x/subversion/tests/libsvn_subr/subst_translate-test.c

Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1486072

Modified: subversion/branches/1.8.x/STATUS
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1486285&r1=1486284&r2=1486285&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Sat May 25 04:01:41 2013
@@ -135,13 +135,6 @@ Approved changes:
 # blocking issues.  If in doubt see this link for details:
 # 
http://subversion.apache.org/docs/community-guide/releasing.html#release-stabilization
 
- * r1486072
-   Fix expansion of custom keywords with values that contain '='.
-   Justification:
-     Custom keyword values containing '=' should work.
-   Votes:
-     +1: stsp, danielsh, cmpilato
-
  * r1481944
    Let Windows compile against BDB 5.0, 5.1, 5.2 and 5.3.
    Justification:

Modified: subversion/branches/1.8.x/subversion/libsvn_subr/subst.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_subr/subst.c?rev=1486285&r1=1486284&r2=1486285&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_subr/subst.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_subr/subst.c Sat May 25 
04:01:41 2013
@@ -297,14 +297,23 @@ build_keywords(apr_hash_t **kw,
   for (i = 0; i < keyword_tokens->nelts; ++i)
     {
       const char *keyword = APR_ARRAY_IDX(keyword_tokens, i, const char *);
-      apr_array_header_t *custom_keyword_tokens = NULL;
+      const char *custom_fmt = NULL;
 
       if (expand_custom_keywords)
-        custom_keyword_tokens = svn_cstring_split(keyword, "=",
-                                                  TRUE /* chop */, pool);
-      if (expand_custom_keywords && custom_keyword_tokens->nelts == 2)
         {
-          const char *custom_fmt;
+          char *sep;
+
+          /* Check if there is a custom keyword definition, started by '='. */
+          sep = strchr(keyword, '=');
+          if (sep)
+            {
+              *sep = '\0'; /* Split keyword's name from custom format. */
+              custom_fmt = sep + 1;
+            }
+        }
+
+      if (custom_fmt)
+        {
           svn_string_t *custom_val;
 
           /* Custom keywords must be allowed to match the name of an
@@ -312,9 +321,6 @@ build_keywords(apr_hash_t **kw,
            * in case new fixed keywords are added to Subversion which
            * happen to match a custom keyword defined somewhere.
            * There is only one global namespace for keyword names. */
-
-          keyword = APR_ARRAY_IDX(custom_keyword_tokens, 0, const char*);
-          custom_fmt = APR_ARRAY_IDX(custom_keyword_tokens, 1, const char*);
           custom_val = keyword_printf(custom_fmt, rev, url, repos_root_url,
                                       date, author, pool);
           svn_hash_sets(*kw, keyword, custom_val);

Modified: 
subversion/branches/1.8.x/subversion/tests/libsvn_subr/subst_translate-test.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/tests/libsvn_subr/subst_translate-test.c?rev=1486285&r1=1486284&r2=1486285&view=diff
==============================================================================
--- 
subversion/branches/1.8.x/subversion/tests/libsvn_subr/subst_translate-test.c 
(original)
+++ 
subversion/branches/1.8.x/subversion/tests/libsvn_subr/subst_translate-test.c 
Sat May 25 04:01:41 2013
@@ -269,6 +269,10 @@ test_svn_subst_build_keywords3(apr_pool_
        "trunk/foo.txt stsp foo.txt %",
        "1234", "http://svn.example.com/repos/trunk/foo.txt";,
        "http://svn.example.com/repos";, "stsp"},
+      {"FOO", "FOO=author%_=%_%a",
+       "author = stsp",
+       "1234", "http://svn.example.com/repos/trunk/foo.txt";,
+       "http://svn.example.com/repos";, "stsp"},
       {"MyKeyword", "MyKeyword=%r%_%u%_%_%a",
        "4567 http://svn.example.com/svn/branches/myfile  jrandom",
        "4567", "http://svn.example.com/svn/branches/myfile";,
@@ -295,6 +299,7 @@ test_svn_subst_build_keywords3(apr_pool_
                                         t->rev, t->url, t->repos_root_url,
                                         0 /* date */, t->author, pool));
       expanded_keyword = svn_hash_gets(kw, t->keyword_name);
+      SVN_TEST_ASSERT(expanded_keyword != NULL);
       SVN_TEST_STRING_ASSERT(expanded_keyword->data, t->expanded_keyword);
     }
 


Reply via email to