"plasma" <plasmaball@pchome.com.tw>


r856245 | julianfoad | 2005-09-20 19:42:28 +0000 (Tue, 20 Sep 2005)

Revise keywords API - represent keywords as a hash for better extensibility.
Implement internal printf-like format characters for keyword expansion.
A part of issue #890. Note that this only introduces the new APIs - making
the rest of the code make use of them will be a separate commit.

Patch by: "plasma" <plasmaball@pchome.com.tw>
          John Peacock <jpeacock@rowman.com>

Review by: lundblad

* subversion/includes/svn_subst.h
  (svn_subst_keywords_t, svn_subst_build_keywords,
   svn_subst_keywords_differ, svn_subst_translate_stream2,
   svn_subst_copy_and_translate2, svn_subst_translate_cstring):
   svn_subst_keywords_differ2, svn_subst_translate_stream3,
   svn_subst_copy_and_translate3, svn_subst_translate_cstring2):
    New functions to replace those deprecated, with keywords in a hash instead
    of a struct.  Also add a 'pool' argument for svn_subst_keywords_differ2().

* subversion/libsvn_subr/subst.c
  (keyword_printf): New private function: printf-style formatting of keywords.
  (date_prop_to_human): Remove: swallowed by keyword_printf.
  (kwstruct_to_kwhash): New private function: convert keywords struct to hash.
  (svn_subst_build_keywords): Convert to API compatibility wrapper.
  (svn_subst_build_keywords2): New function, using keyword_printf().
  (translate_keyword): Interface changes. Also, look up the keyword in the
    passed in buffer, instead of trying to translate all possibilities.
  (svn_subst_keywords_differ): Retain unchanged for API compatibility.
  (svn_subst_keywords_differ2): New version of svn_subst_keywords_differ.
  (svn_subst_translate_stream2): Convert to API compatibility wrapper.
  (svn_subst_translate_stream3): New version of svn_subst_translate_stream2.
  (svn_subst_translate_cstring): Convert to API compatibility wrapper.
  (svn_subst_translate_cstring2): New version of svn_subst_translate_cstring.
  (svn_subst_copy_and_translate2): Convert to API combatibility wrapper.
  (svn_subst_copy_and_translate3): New version of svn_subst_copy_and_translate2.
  (svn_subst_translate_string): Update function call to new API version.
  (svn_subst_detranslate_string): Update function call to new API version.