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

[PATCH] Keywords as Hash 4 - client and test updates

From: John Peacock <jpeacock_at_rowman.com>
Date: 2005-09-21 18:07:10 CEST

Final update to use the new Keywords-as-hash functionality.

[[[

Update the command line client to use the new hash-based keywords
functionality. No tests fail and no new tests required.

* subversion/clients/cmdline/util.c
   (svn_cl__edit_externally):
     Replace call to svn_subst_translate_cstring() with
     svn_subst_translate_cstring2().

* subversion/tests/libsvn_wc/translate-test.c
   (substitute_and_verify):
     Use apr_hash_t instead of svn_subst_keywords_t.
     Initialize test keywords hash with all possible keys for available
     test input values.

]]]

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD  20706
301-459-3366 x.5010
fax 301-429-5748

=== subversion/clients/cmdline/util.c
==================================================================
--- subversion/clients/cmdline/util.c (revision 15750)
+++ subversion/clients/cmdline/util.c (local)
@@ -130,9 +130,9 @@
   if (as_text)
     {
       const char *translated;
- SVN_ERR (svn_subst_translate_cstring (contents->data, &translated,
- APR_EOL_STR, FALSE,
- NULL, FALSE, pool));
+ SVN_ERR (svn_subst_translate_cstring2 (contents->data, &translated,
+ APR_EOL_STR, FALSE,
+ NULL, FALSE, pool));
       translated_contents = svn_string_create ("", pool);
       if (encoding)
         SVN_ERR (svn_utf_cstring_from_utf8_ex (&translated_contents->data,
=== subversion/tests/libsvn_wc/translate-test.c
==================================================================
--- subversion/tests/libsvn_wc/translate-test.c (revision 15750)
+++ subversion/tests/libsvn_wc/translate-test.c (local)
@@ -263,26 +263,56 @@
 {
   svn_error_t *err;
   svn_stringbuf_t *contents;
- svn_subst_keywords_t keywords;
+ apr_hash_t *keywords = apr_hash_make(pool);
   apr_size_t idx = 0;
   apr_size_t i;
   const char *expect[(sizeof (lines) / sizeof (*lines))];
   const char *src_fname = apr_pstrcat (pool, test_name, ".src", NULL);
   const char *dst_fname = apr_pstrcat (pool, test_name, ".dst", NULL);
+ svn_string_t *val;
 
   /** Clean up from previous tests, set up src data, and convert. **/
   SVN_ERR (remove_file (src_fname, pool));
   SVN_ERR (remove_file (dst_fname, pool));
   SVN_ERR (create_file (src_fname, src_eol, pool));
 
- keywords.revision = rev ? svn_string_create (rev, pool) : NULL;
- keywords.date = date ? svn_string_create (date, pool) : NULL;
- keywords.author = author ? svn_string_create (author, pool) : NULL;
- keywords.url = url ? svn_string_create (url, pool) : NULL;
- keywords.id = NULL;
 
- err = svn_subst_copy_and_translate (src_fname, dst_fname, dst_eol, repair,
- &keywords, expand, pool);
+ if (rev)
+ {
+ val = svn_string_create (rev, pool);
+ apr_hash_set(keywords, SVN_KEYWORD_REVISION_LONG,
+ APR_HASH_KEY_STRING, val);
+ apr_hash_set(keywords, SVN_KEYWORD_REVISION_MEDIUM,
+ APR_HASH_KEY_STRING, val);
+ apr_hash_set(keywords, SVN_KEYWORD_REVISION_SHORT,
+ APR_HASH_KEY_STRING, val);
+ }
+ if (date)
+ {
+ val = svn_string_create (date, pool);
+ apr_hash_set(keywords, SVN_KEYWORD_DATE_LONG,
+ APR_HASH_KEY_STRING, val);
+ apr_hash_set(keywords, SVN_KEYWORD_DATE_SHORT,
+ APR_HASH_KEY_STRING, val);
+ }
+ if (author)
+ {
+ val = svn_string_create (author, pool);
+ apr_hash_set(keywords, SVN_KEYWORD_AUTHOR_LONG,
+ APR_HASH_KEY_STRING, val);
+ apr_hash_set(keywords, SVN_KEYWORD_AUTHOR_SHORT,
+ APR_HASH_KEY_STRING, val);
+ }
+ if (url)
+ {
+ val = svn_string_create (url, pool);
+ apr_hash_set(keywords, SVN_KEYWORD_URL_LONG,
+ APR_HASH_KEY_STRING, val);
+ apr_hash_set(keywords, SVN_KEYWORD_URL_SHORT,
+ APR_HASH_KEY_STRING, val);
+ }
+ err = svn_subst_copy_and_translate3 (src_fname, dst_fname, dst_eol, repair,
+ keywords, expand, FALSE, pool);
 
 
   /* Conversion should have failed, if src has mixed eol, and the

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Sep 21 18:07:50 2005

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.