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

PATCH: $Header$ handling

From: Alexander L. Belikoff <abel_at_vallinor4.com>
Date: 2004-07-21 14:16:18 CEST

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

Attached (and included) is a patch implementing the RCS $Header$ keyword. A
lot of people have been asking for this and quite a lot of people use it a
lot.

With patch applied, svn recognizes a new 'Header' keyword and expands it as:

$Header: file:///home/abel/svnwork/repo/pcre/AUTHORS 5 2004-07-21 12:13:45Z
abel $

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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/l6aqG7NDYQkJwERAuNAAJ9teC2b23HEVQsuNQ32Nq0519vDpgCgh96f
+/FUZEHXCLGGs5GTStDtPgQ=
=Ilr2
-----END PGP SIGNATURE-----

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

Received on Wed Jul 21 14:17:00 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.