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

[PATCH] Phase 2 of Keywords as Hash - Take 2

From: John Peacock <jpeacock_at_rowman.com>
Date: 2004-04-24 13:28:43 CEST

And again, the Phase 2 patch without a custom typedef.

John

==================================================================
Change all libraries to use new keyword hash functions from libsvn_subst
See issue #890 for details.

* subversion/libsvn_wc/merge.c
    (svn_wc_merge): use key hashes, new svn_wc__get_keywords() parameters,
     and svn_subst_copy_and_translate2()

* subversion/libsvn_wc/translate.h
    (svn_wc__get_keywords): change signature to use keyword hash

* subversion/libsvn_wc/props.c
    (validate_eol_prop_against_file):
    (svn_wc_prop_set): use svn_subst_translate_stream2(), keyword hashes,
     and new svn_wc__get_keywords()

* subversion/libsvn_wc/adm_crawler.c
    (restore_file): use keyword hashes, svn_subst_copy_and_translate2(),
     and new svn_wc__get_keywords()

* subversion/libsvn_wc/log.c
    (file_xfer_under_path):
    (install_committed_file): use keyword hashes, new svn_wc__get_keywords(),
     and svn_subst_copy_and_translate2()

* subversion/libsvn_wc/adm_ops.c
    (revert_admin_things): use keyword hashes, new svn_wc__get_keywords(),
     and svn_subst_copy_and_translate2()

* subversion/libsvn_wc/translate.c
    (svn_wc_translated_file): use keyword hashes, new svn_wc__get_keywords(),
     and svn_subst_copy_and_translate2()
    (svn_wc__get_keywords): change signature to use keyword hashes and
     svn_subst_build_keywords2()

* subversion/libsvn_client/export.c
    (copy_versioned_files): use keyword hashes, new svn_wc__get_keywords(),
     and svn_subst_copy_and_translate2()
    (struct file_baton): add props hash
    (add_file): allocate storage for props hash
    (change_file_prop): store properties in file_baton

* subversion/libsvn_client/cat.c
    (svn_client_cat): use keyword hashes, svn_subst_build_keywords2(),
     and svn_subst_translate_stream2()

* subversion/libsvn_client/commit.c
    (send_file_contents): use keyword hashes, svn_subst_build_keywords2(),
     and svn_subst_translate_stream2()

* subversion/tests/libsvn_wc/translate-test.c
    (substitute_and_verify): use keyword hashes

-- 
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

Index: subversion/libsvn_wc/merge.c
==================================================================
--- subversion/libsvn_wc/merge.c (/svn/trunk) (revision 8739)
+++ subversion/libsvn_wc/merge.c (/svn/local/keywords) (revision 8739)
@@ -49,7 +49,7 @@
   const char *mt_pt, *mt_bn;
   apr_file_t *tmp_f, *result_f;
   svn_boolean_t is_binary;
- svn_subst_keywords_t *keywords;
+ apr_hash_t *keywords = apr_hash_make(pool);
   const char *eol;
   const svn_wc_entry_t *entry;
   svn_boolean_t contains_conflicts;
@@ -230,18 +230,18 @@
 
           /* Create LEFT and RIGHT backup files, in expanded form.
              We use merge_target's current properties to do the translation. */
- SVN_ERR (svn_wc__get_keywords (&keywords, merge_target, adm_access,
+ SVN_ERR (svn_wc__get_keywords (keywords, merge_target, adm_access,
                                          NULL, pool));
           SVN_ERR (svn_wc__get_eol_style (NULL, &eol, merge_target, adm_access,
                                           pool));
- SVN_ERR (svn_subst_copy_and_translate (left,
- left_copy,
- eol, eol ? TRUE : FALSE,
- keywords, TRUE, pool));
- SVN_ERR (svn_subst_copy_and_translate (right,
- right_copy,
- eol, eol ? TRUE : FALSE,
- keywords, TRUE, pool));
+ SVN_ERR (svn_subst_copy_and_translate2 (left,
+ left_copy,
+ eol, eol ? TRUE : FALSE,
+ keywords, TRUE, pool));
+ SVN_ERR (svn_subst_copy_and_translate2 (right,
+ right_copy,
+ eol, eol ? TRUE : FALSE,
+ keywords, TRUE, pool));
 
           /* Back up MERGE_TARGET verbatim (it's already in expanded form.) */
           SVN_ERR (svn_io_copy_file (merge_target,
@@ -285,13 +285,13 @@
       if (*merge_outcome != svn_wc_merge_unchanged && ! dry_run)
         {
           /* replace MERGE_TARGET with the new merged file, expanding. */
- SVN_ERR (svn_wc__get_keywords (&keywords, merge_target, adm_access,
+ SVN_ERR (svn_wc__get_keywords (keywords, merge_target, adm_access,
                                          NULL, pool));
           SVN_ERR (svn_wc__get_eol_style (NULL, &eol, merge_target, adm_access,
                                           pool));
- SVN_ERR (svn_subst_copy_and_translate (result_target, merge_target,
- eol, eol ? TRUE : FALSE,
- keywords, TRUE, pool));
+ SVN_ERR (svn_subst_copy_and_translate2 (result_target, merge_target,
+ eol, eol ? TRUE : FALSE,
+ keywords, TRUE, pool));
         }
 
       /* Don't forget to clean up tmp_target, result_target, tmp_left,
Index: subversion/libsvn_wc/translate.h
==================================================================
--- subversion/libsvn_wc/translate.h (/svn/trunk) (revision 8739)
+++ subversion/libsvn_wc/translate.h (/svn/local/keywords) (revision 8739)
@@ -69,19 +69,20 @@
                                     const char *eol);
 
 /* Expand keywords for the file at PATH, by parsing a
- whitespace-delimited list of keywords. If any keywords are found
- in the list, allocate *KEYWORDS from POOL, and then populate its
- entries with the related keyword values (also allocated in POOL).
- If no keywords are found in the list, or if there is no list, set
- *KEYWORDS to NULL. ADM_ACCESS must be an access baton for PATH.
+ whitespace-delimited list of keywords. Calling function must have
+ already allocated KEYWORDS from POOL. If any keywords are found
+ in the list, then populate the KEYWORDS hash entries with the related
+ keyword values (also allocated in POOL). If no keywords are found in
+ the list, or if there is no list, leave KEYWORDS hash empty. ADM_ACCESS
+ must be an access baton for PATH.
 
    If FORCE_LIST is non-null, use it as the list; else use the
    SVN_PROP_KEYWORDS property for PATH. In either case, use PATH to
    expand keyword values. If a keyword is in the list, but no
- corresponding value is available, set that element of *KEYWORDS to
+ corresponding value is available, set that hash element of KEYWORDS to
    the empty string ("").
 */
-svn_error_t *svn_wc__get_keywords (svn_subst_keywords_t **keywords,
+svn_error_t *svn_wc__get_keywords (apr_hash_t *keywords,
                                    const char *path,
                                    svn_wc_adm_access_t *adm_access,
                                    const char *force_list,
Index: subversion/libsvn_wc/props.c
==================================================================
--- subversion/libsvn_wc/props.c (/svn/trunk) (revision 8739)
+++ subversion/libsvn_wc/props.c (/svn/local/keywords) (revision 8739)
@@ -972,8 +972,8 @@
      here is whether or not the function fails on inconsistent line
      endings. The function is "translating" to an empty stream. This
      is sneeeeeeeeeeeaky. */
- err = svn_subst_translate_stream (read_stream, write_stream,
- "", FALSE, NULL, FALSE);
+ err = svn_subst_translate_stream2 (read_stream, write_stream,
+ "", FALSE, NULL, FALSE);
   if (err && err->apr_err == SVN_ERR_IO_INCONSISTENT_EOL)
     return svn_error_createf (SVN_ERR_ILLEGAL_TARGET, err,
                               _("File '%s' has inconsistent newlines"), path);
@@ -995,7 +995,7 @@
   svn_error_t *err;
   apr_hash_t *prophash;
   apr_file_t *fp = NULL;
- svn_subst_keywords_t *old_keywords;
+ apr_hash_t *old_keywords = apr_hash_make(pool);
   svn_stringbuf_t *new_value = NULL;
   svn_node_kind_t kind;
   enum svn_prop_kind prop_kind = svn_property_kind (NULL, name);
@@ -1097,7 +1097,7 @@
    * from the old one.
    */
   if (kind == svn_node_file && strcmp (name, SVN_PROP_KEYWORDS) == 0)
- SVN_ERR (svn_wc__get_keywords (&old_keywords, path, adm_access, NULL,
+ SVN_ERR (svn_wc__get_keywords (old_keywords, path, adm_access, NULL,
                                    pool));
 
   /* Now we have all the properties in our hash. Simply merge the new
@@ -1125,11 +1125,11 @@
 
   if (kind == svn_node_file && strcmp (name, SVN_PROP_KEYWORDS) == 0)
     {
- svn_subst_keywords_t *new_keywords;
- SVN_ERR (svn_wc__get_keywords (&new_keywords, path, adm_access, NULL,
+ apr_hash_t *new_keywords = apr_hash_make(pool);
+ SVN_ERR (svn_wc__get_keywords (new_keywords, path, adm_access, NULL,
                                      pool));
 
- if (svn_subst_keywords_differ (old_keywords, new_keywords, FALSE))
+ if (svn_subst_keywords_differ2 (old_keywords, new_keywords, FALSE, pool))
         {
           const char *base_name;
           svn_wc_entry_t tmp_entry;
Index: subversion/libsvn_wc/adm_crawler.c
==================================================================
--- subversion/libsvn_wc/adm_crawler.c (/svn/trunk) (revision 8739)
+++ subversion/libsvn_wc/adm_crawler.c (/svn/local/keywords) (revision 8739)
@@ -62,7 +62,7 @@
               apr_pool_t *pool)
 {
   const char *text_base_path, *tmp_text_base_path;
- svn_subst_keywords_t *keywords;
+ apr_hash_t *keywords = apr_hash_make(pool);
   const char *eol;
   const svn_wc_entry_t *entry;
   svn_wc_entry_t newentry;
@@ -78,19 +78,19 @@
                              FALSE, pool));
 
   SVN_ERR (svn_wc__get_eol_style (NULL, &eol, file_path, adm_access, pool));
- SVN_ERR (svn_wc__get_keywords (&keywords,
+ SVN_ERR (svn_wc__get_keywords (keywords,
                                  file_path, adm_access, NULL, pool));
   
   /* When copying the tmp-text-base out to the working copy, make
      sure to do any eol translations or keyword substitutions,
      as dictated by the property values. If these properties
      are turned off, then this is just a normal copy. */
- SVN_ERR (svn_subst_copy_and_translate (tmp_text_base_path,
- file_path,
- eol, FALSE, /* don't repair */
- keywords,
- TRUE, /* expand keywords */
- pool));
+ SVN_ERR (svn_subst_copy_and_translate2 (tmp_text_base_path,
+ file_path,
+ eol, FALSE, /* don't repair */
+ keywords,
+ TRUE, /* expand keywords */
+ pool));
   
   SVN_ERR (svn_io_remove_file (tmp_text_base_path, pool));
 
Index: subversion/libsvn_wc/log.c
==================================================================
--- subversion/libsvn_wc/log.c (/svn/trunk) (revision 8739)
+++ subversion/libsvn_wc/log.c (/svn/local/keywords) (revision 8739)
@@ -111,22 +111,22 @@
 
     case svn_wc__xfer_cp_and_translate:
       {
- svn_subst_keywords_t *keywords;
+ apr_hash_t *keywords = apr_hash_make(pool);
         const char *eol_str;
 
         /* Note that this action takes properties from dest, not source. */
- SVN_ERR (svn_wc__get_keywords (&keywords, full_dest_path, adm_access,
+ SVN_ERR (svn_wc__get_keywords (keywords, full_dest_path, adm_access,
                                        NULL, pool));
         SVN_ERR (svn_wc__get_eol_style (NULL, &eol_str, full_dest_path,
                                         adm_access, pool));
 
- SVN_ERR (svn_subst_copy_and_translate (full_from_path,
- full_dest_path,
- eol_str,
- TRUE,
- keywords,
- TRUE,
- pool));
+ SVN_ERR (svn_subst_copy_and_translate2 (full_from_path,
+ full_dest_path,
+ eol_str,
+ TRUE,
+ keywords,
+ TRUE,
+ pool));
 
         /* After copying, set the file executable if props dictate. */
         return svn_wc__maybe_set_executable (NULL, full_dest_path, adm_access,
@@ -135,11 +135,11 @@
 
     case svn_wc__xfer_cp_and_detranslate:
       {
- svn_subst_keywords_t *keywords;
+ apr_hash_t *keywords = apr_hash_make(pool);
         const char *eol_str;
 
         /* Note that this action takes properties from source, not dest. */
- SVN_ERR (svn_wc__get_keywords (&keywords, full_from_path, adm_access,
+ SVN_ERR (svn_wc__get_keywords (keywords, full_from_path, adm_access,
                                        NULL, pool));
         SVN_ERR (svn_wc__get_eol_style (NULL, &eol_str, full_from_path,
                                         adm_access, pool));
@@ -147,13 +147,13 @@
         /* If any specific eol style was indicated, then detranslate
            back to repository normal form ("\n"), repairingly. But if
            no style indicated, don't touch line endings at all. */
- return svn_subst_copy_and_translate (full_from_path,
- full_dest_path,
- (eol_str ? "\n" : NULL),
- (eol_str ? TRUE : FALSE),
- keywords,
- FALSE, /* contract keywords */
- pool);
+ return svn_subst_copy_and_translate2 (full_from_path,
+ full_dest_path,
+ (eol_str ? "\n" : NULL),
+ (eol_str ? TRUE : FALSE),
+ keywords,
+ FALSE, /* contract keywords */
+ pool);
       }
 
     case svn_wc__xfer_mv:
@@ -205,7 +205,7 @@
   const char *filepath;
   const char *tmp_text_base;
   svn_node_kind_t kind;
- svn_subst_keywords_t *keywords;
+ apr_hash_t *keywords = apr_hash_make(pool);
   apr_file_t *ignored;
   svn_boolean_t same, did_set;
   const char *tmp_wfile, *pdir, *bname;
@@ -235,7 +235,7 @@
 
   /* start off getting the latest translation prop values. */
   SVN_ERR (svn_wc__get_eol_style (NULL, &eol_str, filepath, adm_access, pool));
- SVN_ERR (svn_wc__get_keywords (&keywords, filepath, adm_access, NULL, pool));
+ SVN_ERR (svn_wc__get_keywords (keywords, filepath, adm_access, NULL, pool));
 
   svn_path_split (filepath, &pdir, &bname, pool);
   tmp_wfile = svn_wc__adm_path (pdir, TRUE, pool, bname, NULL);
@@ -250,21 +250,21 @@
   SVN_ERR (svn_io_check_path (tmp_text_base, &kind, pool));
 
   if (kind == svn_node_file)
- SVN_ERR (svn_subst_copy_and_translate (tmp_text_base,
- tmp_wfile,
- eol_str,
- FALSE, /* don't repair eol */
- keywords,
- TRUE, /* expand keywords */
- pool));
+ SVN_ERR (svn_subst_copy_and_translate2 (tmp_text_base,
+ tmp_wfile,
+ eol_str,
+ FALSE, /* don't repair eol */
+ keywords,
+ TRUE, /* expand keywords */
+ pool));
   else
- SVN_ERR (svn_subst_copy_and_translate (filepath,
- tmp_wfile,
- eol_str,
- FALSE, /* don't repair eol */
- keywords,
- TRUE, /* expand keywords */
- pool));
+ SVN_ERR (svn_subst_copy_and_translate2 (filepath,
+ tmp_wfile,
+ eol_str,
+ FALSE, /* don't repair eol */
+ keywords,
+ TRUE, /* expand keywords */
+ pool));
 
   SVN_ERR (svn_io_files_contents_same_p (&same, tmp_wfile, filepath, pool));
   
Index: subversion/libsvn_wc/adm_ops.c
==================================================================
--- subversion/libsvn_wc/adm_ops.c (/svn/trunk) (revision 8739)
+++ subversion/libsvn_wc/adm_ops.c (/svn/local/keywords) (revision 8739)
@@ -1249,25 +1249,25 @@
              missing altogether), copy the text-base out into
              the working copy, and update the timestamp in the entries
              file. */
- svn_subst_keywords_t *keywords;
+ apr_hash_t *keywords = apr_hash_make(pool);
           const char *eol;
           
           SVN_ERR (svn_wc__get_eol_style (NULL, &eol, fullpath, adm_access,
                                           pool));
- SVN_ERR (svn_wc__get_keywords (&keywords, fullpath, adm_access, NULL,
+ SVN_ERR (svn_wc__get_keywords (keywords, fullpath, adm_access, NULL,
                                          pool));
 
           /* When copying the text-base out to the working copy, make
              sure to do any eol translations or keyword substitutions,
              as dictated by the property values. If these properties
              are turned off, then this is just a normal copy. */
- if ((err = svn_subst_copy_and_translate (base_thing,
- fullpath,
- eol,
- FALSE, /* don't repair */
- keywords,
- TRUE, /* expand keywords */
- pool)))
+ if ((err = svn_subst_copy_and_translate2 (base_thing,
+ fullpath,
+ eol,
+ FALSE, /* don't repair */
+ keywords,
+ TRUE, /* expand keywords */
+ pool)))
             return revert_error (err, fullpath, "restoring text", pool);
 
           /* If necessary, tweak the new working file's executable bit. */
Index: subversion/libsvn_wc/translate.c
==================================================================
--- subversion/libsvn_wc/translate.c (/svn/trunk) (revision 8739)
+++ subversion/libsvn_wc/translate.c (/svn/local/keywords) (revision 8739)
@@ -56,10 +56,10 @@
 {
   svn_subst_eol_style_t style;
   const char *eol;
- svn_subst_keywords_t *keywords;
+ apr_hash_t *keywords = apr_hash_make(pool);
   
   SVN_ERR (svn_wc__get_eol_style (&style, &eol, vfile, adm_access, pool));
- SVN_ERR (svn_wc__get_keywords (&keywords, vfile, adm_access, NULL, pool));
+ SVN_ERR (svn_wc__get_keywords (keywords, vfile, adm_access, NULL, pool));
 
   if ((style == svn_subst_eol_style_none) && (! keywords))
     {
@@ -91,33 +91,33 @@
       
       if (style == svn_subst_eol_style_fixed)
         {
- SVN_ERR (svn_subst_copy_and_translate (vfile,
- tmp_vfile,
- eol,
- TRUE,
- keywords,
- FALSE,
- pool));
+ SVN_ERR (svn_subst_copy_and_translate2 (vfile,
+ tmp_vfile,
+ eol,
+ TRUE,
+ keywords,
+ FALSE,
+ pool));
         }
       else if (style == svn_subst_eol_style_native)
         {
- SVN_ERR (svn_subst_copy_and_translate (vfile,
- tmp_vfile,
- SVN_WC__DEFAULT_EOL_MARKER,
- force_repair,
- keywords,
- FALSE,
- pool));
+ SVN_ERR (svn_subst_copy_and_translate2 (vfile,
+ tmp_vfile,
+ SVN_WC__DEFAULT_EOL_MARKER,
+ force_repair,
+ keywords,
+ FALSE,
+ pool));
         }
       else if (style == svn_subst_eol_style_none)
         {
- SVN_ERR (svn_subst_copy_and_translate (vfile,
- tmp_vfile,
- NULL,
- force_repair,
- keywords,
- FALSE,
- pool));
+ SVN_ERR (svn_subst_copy_and_translate2 (vfile,
+ tmp_vfile,
+ NULL,
+ force_repair,
+ keywords,
+ FALSE,
+ pool));
         }
       else
         {
@@ -171,19 +171,16 @@
 
 
 svn_error_t *
-svn_wc__get_keywords (svn_subst_keywords_t **keywords,
+svn_wc__get_keywords (apr_hash_t *keywords,
                       const char *path,
                       svn_wc_adm_access_t *adm_access,
                       const char *force_list,
                       apr_pool_t *pool)
 {
   const char *list;
- svn_subst_keywords_t tmp_keywords = { 0 };
   const svn_wc_entry_t *entry = NULL;
+ apr_hash_t *props;
 
- /* Start by assuming no keywords. */
- *keywords = NULL;
-
   /* Choose a property list to parse: either the one that came into
      this function, or the one attached to PATH. */
   if (force_list == NULL)
@@ -204,17 +201,17 @@
 
   SVN_ERR (svn_wc_entry (&entry, path, adm_access, FALSE, pool));
 
- SVN_ERR (svn_subst_build_keywords (&tmp_keywords,
- list,
- apr_psprintf (pool, "%" SVN_REVNUM_T_FMT,
- entry->cmt_rev),
- entry->url,
- entry->cmt_date,
- entry->cmt_author,
- pool));
+ SVN_ERR (svn_wc_prop_list (&props, path, adm_access, pool));
+ SVN_ERR (svn_subst_build_keywords2 (keywords,
+ list,
+ apr_psprintf (pool, "%" SVN_REVNUM_T_FMT,
+ entry->cmt_rev),
+ entry->url,
+ entry->cmt_date,
+ entry->cmt_author,
+ props,
+ pool));
 
- *keywords = apr_pmemdup (pool, &tmp_keywords, sizeof (tmp_keywords));
-
   return SVN_NO_ERROR;
 }
 
Index: subversion/libsvn_client/export.c
==================================================================
--- subversion/libsvn_client/export.c (/svn/trunk) (revision 8739)
+++ subversion/libsvn_client/export.c (/svn/local/keywords) (revision 8739)
@@ -151,7 +151,7 @@
         {
           const char *copy_from = svn_path_join (from, item, iterpool);
           const char *copy_to = svn_path_join (to, item, iterpool);
- svn_subst_keywords_t kw = { 0 };
+ apr_hash_t *kw = apr_hash_make(pool);
           svn_subst_eol_style_t style;
           apr_hash_t *props;
           const char *base;
@@ -235,14 +235,14 @@
                   author = entry->cmt_author;
                 }
               
- SVN_ERR (svn_subst_build_keywords
- (&kw, keywords->data,
+ SVN_ERR (svn_subst_build_keywords2
+ (kw, keywords->data,
                         apr_psprintf (iterpool, fmt, entry->cmt_rev),
- entry->url, tm, author, iterpool));
+ entry->url, tm, author, props, iterpool));
             }
           
- SVN_ERR (svn_subst_copy_and_translate (base, copy_to, eol, FALSE,
- &kw, TRUE, iterpool));
+ SVN_ERR (svn_subst_copy_and_translate2 (base, copy_to, eol, FALSE,
+ kw, TRUE, iterpool));
           if (executable)
             SVN_ERR (svn_io_set_file_executable (copy_to, TRUE,
                                                  FALSE, iterpool));
@@ -352,6 +352,8 @@
   const char *author;
   apr_time_t date;
 
+ apr_hash_t *props;
+
   /* Pool associated with this baton. */
   apr_pool_t *pool;
 };
@@ -465,6 +467,7 @@
   fb->edit_baton = eb;
   fb->path = full_path;
   fb->url = full_url;
+ fb->props = apr_hash_make (pool);
   fb->pool = pool;
 
   *baton = fb;
@@ -529,6 +532,9 @@
   if (! value)
     return SVN_NO_ERROR;
 
+ /* Store every property */
+ apr_hash_set(fb->props, name, APR_HASH_KEY_STRING, value);
+
   /* Store only the magic three properties. */
   if (strcmp (name, SVN_PROP_EOL_STYLE) == 0)
     fb->eol_style_val = svn_string_dup (value, fb->pool);
@@ -605,21 +611,21 @@
     {
       svn_subst_eol_style_t style;
       const char *eol;
- svn_subst_keywords_t final_kw = {0};
+ apr_hash_t *final_kw = apr_hash_make(pool);
 
       if (fb->eol_style_val)
         svn_subst_eol_style_from_value (&style, &eol, fb->eol_style_val->data);
 
       if (fb->keywords_val)
- SVN_ERR (svn_subst_build_keywords (&final_kw, fb->keywords_val->data,
- fb->revision, fb->url, fb->date,
- fb->author, pool));
+ SVN_ERR (svn_subst_build_keywords2 (final_kw, fb->keywords_val->data,
+ fb->revision, fb->url, fb->date,
+ fb->author, fb->props, pool));
 
- SVN_ERR (svn_subst_copy_and_translate
+ SVN_ERR (svn_subst_copy_and_translate2
                (fb->tmppath, fb->path,
                 fb->eol_style_val ? eol : NULL,
                 fb->eol_style_val ? TRUE : FALSE, /* repair */
- fb->keywords_val ? &final_kw : NULL,
+ fb->keywords_val ? final_kw : NULL,
                 fb->keywords_val ? TRUE : FALSE, /* expand */
                 pool));
 
Index: subversion/libsvn_client/cat.c
==================================================================
--- subversion/libsvn_client/cat.c (/svn/trunk) (revision 8739)
+++ subversion/libsvn_client/cat.c (/svn/local/keywords) (revision 8739)
@@ -70,7 +70,7 @@
   if (svn_path_is_url (path_or_url))
     {
       /* If an explicit URL was passed in, just use it. */
- good_rev = revision;
+ good_rev = (svn_opt_revision_t *)revision;
       url = initial_url;
     }
   else
@@ -140,7 +140,7 @@
     }
   else
     {
- svn_subst_keywords_t kw = { 0 };
+ apr_hash_t *kw = apr_hash_make(pool);
       svn_subst_eol_style_t style;
       const char *temp_dir;
       const char *tmp_filename;
@@ -184,16 +184,17 @@
           if (cmt_date)
             SVN_ERR (svn_time_from_cstring (&when, cmt_date->data, pool));
 
- SVN_ERR (svn_subst_build_keywords
- (&kw, keywords->data,
+ SVN_ERR (svn_subst_build_keywords2
+ (kw, keywords->data,
                     cmt_rev->data,
                     url,
                     when,
                     cmt_author ? cmt_author->data : NULL,
+ props,
                     pool));
         }
 
- SVN_ERR (svn_subst_translate_stream (tmp_stream, out, eol, FALSE, &kw,
+ SVN_ERR (svn_subst_translate_stream2 (tmp_stream, out, eol, FALSE, kw,
                                            TRUE));
 
       SVN_ERR (svn_stream_close (tmp_stream));
Index: subversion/libsvn_client/commit.c
==================================================================
--- subversion/libsvn_client/commit.c (/svn/trunk) (revision 8739)
+++ subversion/libsvn_client/commit.c (/svn/local/keywords) (revision 8739)
@@ -84,7 +84,7 @@
      Keywords get unexpanded. */
   if (eol_style_val || keywords_val)
     {
- svn_subst_keywords_t keywords = {0};
+ apr_hash_t *keywords = apr_hash_make(pool);
       const char *temp_dir;
       svn_stream_t *tmp_stream;
       apr_file_t *tmp_f;
@@ -95,9 +95,9 @@
 
       /* Generate a keyword structure. */
       if (keywords_val)
- SVN_ERR (svn_subst_build_keywords (&keywords, keywords_val->data,
- APR_STRINGIFY(SVN_INVALID_REVNUM),
- "", 0, "", pool));
+ SVN_ERR (svn_subst_build_keywords2 (keywords, keywords_val->data,
+ APR_STRINGIFY(SVN_INVALID_REVNUM),
+ "", 0, "", properties, pool));
 
       /* Now create a new tempfile, and open a stream to it. */
       SVN_ERR (svn_io_temp_dir (&temp_dir, pool));
@@ -109,10 +109,10 @@
 
       /* Copy the original file to the temporary one, de-translating
          along the way. */
- if ((err = svn_subst_translate_stream (contents, tmp_stream,
+ if ((err = svn_subst_translate_stream2 (contents, tmp_stream,
                                              eol_style_val ? "\n" : NULL,
                                              FALSE,
- keywords_val ? &keywords : NULL,
+ keywords_val ? keywords : NULL,
                                              FALSE)))
         goto cleanup;
 
Index: subversion/tests/libsvn_wc/translate-test.c
==================================================================
--- subversion/tests/libsvn_wc/translate-test.c (/svn/trunk) (revision 8739)
+++ subversion/tests/libsvn_wc/translate-test.c (/svn/local/keywords) (revision 8739)
@@ -264,26 +264,54 @@
 {
   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;
+ 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_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_translate (src_fname, dst_fname, dst_eol, repair,
- &keywords, expand, pool);
+ err = svn_subst_copy_and_translate2 (src_fname, dst_fname, dst_eol, repair,
+ keywords, expand, 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 Sat Apr 24 13:28:43 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.