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

PATCH: $Header$ keyword support (now with proper log message)

From: Alexander L. Belikoff <abel_at_vallinor4.com>
Date: 2004-07-22 04:01:11 CEST

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Implemented Header keyword (similar to the one in RCS/CVS)

* subversion/include/svn_subst.h
  (svn_subst_keywords_t): Added pointer for the Header keyword expansion.

* subversion/include/svn_types.h
  (new macro): Added SVN_KEYWORD_HEADER macro for Header keyword

* subversion/libsvn_subr/subst.c
  (svn_subst_build_keywords): Added Header keyword value creation.
  (translate_keyword): Header jeyword expansion

* subversion/clients/cmdline/main.c
  (svn_cl__cmd_table): Added Header keyword description to the help message.

* subversion/tests/libsvn_wc/translate-test.c
  (substitute_and_verify) Pointer to Header expansion properly initialized.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Index: subversion/include/svn_subst.h
===================================================================
- --- subversion/include/svn_subst.h (revision 10373)
+++ subversion/include/svn_subst.h (working copy)
@@ -83,6 +83,7 @@
   const svn_string_t *author;
   const svn_string_t *url;
   const svn_string_t *id;
+ const svn_string_t *header;
 } svn_subst_keywords_t;
 
 
Index: subversion/include/svn_types.h
===================================================================
- --- subversion/include/svn_types.h (revision 10373)
+++ subversion/include/svn_types.h (working copy)
@@ -283,6 +283,9 @@
  */
 #define SVN_KEYWORD_ID "Id"
 
+/** A dearly missing Header */
+#define SVN_KEYWORD_HEADER "Header"
+
 /** @} */
 
 
Index: subversion/libsvn_subr/subst.c
===================================================================
- --- subversion/libsvn_subr/subst.c (revision 10373)
+++ subversion/libsvn_subr/subst.c (working copy)
@@ -183,6 +183,19 @@
                                        human_date ? human_date : "",
                                        author ? author : "");
         }
+ else if ((! strcasecmp (keyword, SVN_KEYWORD_HEADER)))
+ {
+ const char *human_date = NULL;
+
+ if (date)
+ SVN_ERR (date_prop_to_human (&human_date, FALSE, date, pool));
+
+ kw->header = svn_string_createf (pool, "%s %s %s %s",
+ (url ? url : ""),
+ rev,
+ human_date ? human_date : "",
+ author ? author : "");
+ }
     }
 
   return SVN_NO_ERROR;
@@ -420,6 +433,16 @@
         return TRUE;
     }
 
+ /* Header */
+ if (keywords->header)
+ {
+ if (translate_keyword_subst (buf, len,
+ SVN_KEYWORD_HEADER,
+ (sizeof (SVN_KEYWORD_HEADER)) - 1,
+ expand ? keywords->header : NULL))
+ return TRUE;
+ }
+
   /* No translations were successful. Return FALSE. */
   return FALSE;
 }
Index: subversion/clients/cmdline/main.c
===================================================================
- --- subversion/clients/cmdline/main.c (revision 10373)
+++ subversion/clients/cmdline/main.c (working copy)
@@ -520,6 +520,7 @@
        " Id - A compressed summary of the "
        "previous\n"
        " 4 keywords.\n"
+ " Header - Same as Id but with full file URL\n"
        " svn:executable - If present, make the file executable. This\n"
        " property cannot be set on a directory. A non-recursive "
        "attempt\n"
Index: subversion/tests/libsvn_wc/translate-test.c
===================================================================
- --- subversion/tests/libsvn_wc/translate-test.c (revision 10373)
+++ subversion/tests/libsvn_wc/translate-test.c (working copy)
@@ -281,6 +281,7 @@
   keywords.author = author ? svn_string_create (author, pool) : NULL;
   keywords.url = url ? svn_string_create (url, pool) : NULL;
   keywords.id = NULL;
+ keywords.header = NULL;
 
   err = svn_subst_copy_and_translate (src_fname, dst_fname, dst_eol, repair,
                                       &keywords, expand, pool);

- --
Alexander L. Belikoff GPG f/pr: 0D58 A804 1AB1 4CD8 8DA9
Bloomberg L.P. 424B A86E CD0D 8424 2701
abel *at* vallinor4 *dot* com (http://pgp5.ai.mit.edu for the key)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA/x/rqG7NDYQkJwERAoppAJ0VbWr6ZtOt9QDI2r1fuG76G/SlkACglR0T
bZwTa5Y/jG0nSMO0Nkm0Lm8=
=3BEy
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Received on Thu Jul 22 04:01:26 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.