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

[PATCH] Generate ISO-8601 dates and canonicalize dates on 'svnadmin dump'

From: Nuutti Kotivuori <naked_at_iki.fi>
Date: 2002-06-22 20:17:51 CEST

So, this is a patch that makes subversion generate ISO-8601 - and
canonicalize dates to that format on 'svnadmin dump'. So to make all
dates in the repository ISO-8601, a dump & load is needed.

Quick review round, just in case, and then commit.

-- Naked

Log message:
Generate ISO-8601 dates from now on. Also canonicalize dates on 'svnadmin
dump'. The new datestamps look like this:

  2002-06-22T09:14:58.030390Z

* subversion/libsvn_repos/dump.c: Include svn_time.h.
(write_revision_record): Canonicalize dates.

* subversion/tests/libsvn_subr/time-test.c
(test_time_to_nts): Enable the test.
(test_funcs): Ditti.

* subversion/libsvn_subr/time.c
(svn_time_to_nts): Generate new style timestamps.

Patch:
Index: ./subversion/libsvn_subr/time.c
===================================================================
--- ./subversion/libsvn_subr/time.c
+++ ./subversion/libsvn_subr/time.c Sat Jun 22 20:14:49 2002
@@ -77,9 +77,6 @@
   /* It would be nice to use apr_strftime(), but APR doesn't give a
      way to convert back, so we wouldn't be able to share the format
      string between the writer and reader. */
- /* XXX: Enable this bit of code and remove the one below when a
- bootstrap tarball has been released with this change included.
-
   t_cstr = apr_psprintf (pool,
                          timestamp_format,
                          exploded_time.tm_year + 1900,
@@ -89,8 +86,9 @@
                          exploded_time.tm_min,
                          exploded_time.tm_sec,
                          exploded_time.tm_usec);
- */
 
+ /* ### Remove this when the old style timestamp parsing is taken
+ out.
   t_cstr = apr_psprintf (pool,
                          old_timestamp_format,
                          apr_day_snames[exploded_time.tm_wday],
@@ -104,6 +102,7 @@
                          exploded_time.tm_yday + 1,
                          exploded_time.tm_isdst,
                          exploded_time.tm_gmtoff);
+ */
 
   return t_cstr;
 }
Index: ./subversion/tests/libsvn_subr/time-test.c
===================================================================
--- ./subversion/tests/libsvn_subr/time-test.c
+++ ./subversion/tests/libsvn_subr/time-test.c Sat Jun 22 20:15:43 2002
@@ -30,7 +30,6 @@
 "Mon 13 May 2002 22:00:50.966679 (day 133, dst 1, gmt_off 010800)";
 
 
-#if 0 /* ### XXX: enable after new timestamps are in use */
 static svn_error_t *
 test_time_to_nts (const char **msg,
                   svn_boolean_t msg_only,
@@ -56,7 +55,6 @@
 
   return SVN_NO_ERROR;
 }
-#endif /* 0 */
 
 
 static svn_error_t *
@@ -150,8 +148,7 @@
                                svn_boolean_t msg_only,
                                apr_pool_t *pool) = {
   0,
- /* ### XXX: enable after new timestamps are in use */
- /* test_time_to_nts, */
+ test_time_to_nts,
   test_time_from_nts,
   test_time_from_nts_old,
   test_time_invariant,
Index: ./subversion/libsvn_repos/dump.c
===================================================================
--- ./subversion/libsvn_repos/dump.c
+++ ./subversion/libsvn_repos/dump.c Sat Jun 22 21:06:36 2002
@@ -23,6 +23,7 @@
 #include "svn_string.h"
 #include "svn_hash.h"
 #include "svn_path.h"
+#include "svn_time.h"
 
 
 /*----------------------------------------------------------------------*/
@@ -597,6 +598,27 @@
   svn_stringbuf_t *encoded_prophash;
 
   SVN_ERR (svn_fs_revision_proplist (&props, fs, rev, pool));
+
+ {
+ /* Run revision date properties through the time conversion to
+ canonicalize them. */
+ /* ### Remove this when it is no longer needed for sure. */
+ apr_time_t timetemp;
+ svn_string_t *datevalue = apr_hash_get (props,
+ SVN_PROP_REVISION_DATE,
+ APR_HASH_KEY_STRING);
+ if(datevalue)
+ {
+ SVN_ERR (svn_time_from_nts (&timetemp, datevalue->data, pool));
+ datevalue = svn_string_create (svn_time_to_nts (timetemp, pool),
+ pool);
+ apr_hash_set (props,
+ SVN_PROP_REVISION_DATE,
+ APR_HASH_KEY_STRING,
+ datevalue);
+ }
+ }
+
   write_hash_to_stringbuf (props, svn_unpack_bytestring,
                            &encoded_prophash, pool);
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jun 22 20:20:09 2002

This is an archived mail posted to the Subversion Dev mailing list.