You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2015/03/05 20:40:51 UTC

svn commit: r1664462 - in /subversion/branches/1.9.x: ./ STATUS subversion/libsvn_fs_base/revs-txns.c subversion/tests/libsvn_fs/fs-test.c

Author: svn-role
Date: Thu Mar  5 19:40:42 2015
New Revision: 1664462

URL: http://svn.apache.org/r1664462
Log:
Merge the r1663697 group from trunk:

 * r1663697, r1663706, r1663749
   Set svn:date earlier when creating a BDB txn.
   Justification:
     Required for new-in-1.9 svn:client-date to work properly on BDB.
   Notes:
     r1663697 is the fix for this problem, r1663706 and r1663749 add a test.
   Votes:
     +1: philip, rhuijben, kotkov

Modified:
    subversion/branches/1.9.x/   (props changed)
    subversion/branches/1.9.x/STATUS
    subversion/branches/1.9.x/subversion/libsvn_fs_base/revs-txns.c
    subversion/branches/1.9.x/subversion/tests/libsvn_fs/fs-test.c

Propchange: subversion/branches/1.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar  5 19:40:42 2015
@@ -89,4 +89,4 @@
 /subversion/branches/verify-at-commit:1462039-1462408
 /subversion/branches/verify-keep-going:1439280-1546110
 /subversion/branches/wc-collate-path:1402685-1480384
-/subversion/trunk:1660545-1660547,1660549-1662901,1663003
+/subversion/trunk:1660545-1660547,1660549-1662901,1663003,1663697,1663706,1663749

Modified: subversion/branches/1.9.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/STATUS?rev=1664462&r1=1664461&r2=1664462&view=diff
==============================================================================
--- subversion/branches/1.9.x/STATUS (original)
+++ subversion/branches/1.9.x/STATUS Thu Mar  5 19:40:42 2015
@@ -142,15 +142,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1663697, r1663706, r1663749
-   Set svn:date earlier when creating a BDB txn.
-   Justification:
-     Required for new-in-1.9 svn:client-date to work properly on BDB.
-   Notes:
-     r1663697 is the fix for this problem, r1663706 and r1663749 add a test.
-   Votes:
-     +1: philip, rhuijben, kotkov
-
  * r1664084, r1664085
    Reduce memory footprint of svn_repos_deleted_rev().
    Justification:

Modified: subversion/branches/1.9.x/subversion/libsvn_fs_base/revs-txns.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/libsvn_fs_base/revs-txns.c?rev=1664462&r1=1664461&r2=1664462&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/libsvn_fs_base/revs-txns.c (original)
+++ subversion/branches/1.9.x/subversion/libsvn_fs_base/revs-txns.c Thu Mar  5 19:40:42 2015
@@ -711,6 +711,23 @@ txn_body_begin_txn(void *baton, trail_t
       SVN_ERR(txn_body_change_txn_prop(&cpargs, trail));
     }
 
+  /* Put a datestamp on the newly created txn, so we always know
+     exactly how old it is.  (This will help sysadmins identify
+     long-abandoned txns that may need to be manually removed.) Do
+     this before setting CLIENT_DATE so that it is not recorded as an
+     explicit setting. */
+  {
+    struct change_txn_prop_args cpargs;
+    svn_string_t date;
+    cpargs.fs = trail->fs;
+    cpargs.id = txn_id;
+    cpargs.name = SVN_PROP_REVISION_DATE;
+    date.data  = svn_time_to_cstring(apr_time_now(), trail->pool);
+    date.len = strlen(date.data);
+    cpargs.value = &date;
+    SVN_ERR(txn_body_change_txn_prop(&cpargs, trail));
+  }
+
   if (args->flags & SVN_FS_TXN_CLIENT_DATE)
     {
       struct change_txn_prop_args cpargs;
@@ -737,7 +754,6 @@ svn_fs_base__begin_txn(svn_fs_txn_t **tx
 {
   svn_fs_txn_t *txn;
   struct begin_txn_args args;
-  svn_string_t date;
 
   SVN_ERR(svn_fs__check_fs(fs, TRUE));
 
@@ -748,15 +764,7 @@ svn_fs_base__begin_txn(svn_fs_txn_t **tx
 
   *txn_p = txn;
 
-  /* Put a datestamp on the newly created txn, so we always know
-     exactly how old it is.  (This will help sysadmins identify
-     long-abandoned txns that may need to be manually removed.)  When
-     a txn is promoted to a revision, this property will be
-     automatically overwritten with a revision datestamp. */
-  date.data = svn_time_to_cstring(apr_time_now(), pool);
-  date.len = strlen(date.data);
-  return svn_fs_base__change_txn_prop(txn, SVN_PROP_REVISION_DATE,
-                                       &date, pool);
+  return SVN_NO_ERROR;
 }
 
 

Modified: subversion/branches/1.9.x/subversion/tests/libsvn_fs/fs-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/tests/libsvn_fs/fs-test.c?rev=1664462&r1=1664461&r2=1664462&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/tests/libsvn_fs/fs-test.c (original)
+++ subversion/branches/1.9.x/subversion/tests/libsvn_fs/fs-test.c Thu Mar  5 19:40:42 2015
@@ -5167,6 +5167,17 @@ test_fs_info_format(const svn_test_opts_
   return SVN_NO_ERROR;
 }
 
+/* Sleeps until apr_time_now() value changes. */
+static void sleep_for_timestamps(void)
+{
+  apr_time_t start = apr_time_now();
+
+  while (start == apr_time_now())
+    {
+      apr_sleep(APR_USEC_PER_SEC / 1000);
+    }
+}
+
 static svn_error_t *
 commit_timestamp(const svn_test_opts_t *opts,
                  apr_pool_t *pool)
@@ -5178,6 +5189,7 @@ commit_timestamp(const svn_test_opts_t *
   svn_revnum_t rev = 0;
   apr_hash_t *proplist;
   svn_string_t *svn_date;
+  svn_string_t *txn_svn_date;
 
   SVN_ERR(svn_test__create_fs(&fs, "test-fs-commit-timestamp",
                               opts, pool));
@@ -5257,6 +5269,37 @@ commit_timestamp(const svn_test_opts_t *
                           APR_HASH_KEY_STRING);
   SVN_TEST_ASSERT(svn_date);
 
+  /* Commit that doesn't do anything special about svn:date. */
+  SVN_ERR(svn_fs_begin_txn2(&txn, fs, rev, 0, pool));
+  SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+  SVN_ERR(svn_fs_make_dir(txn_root, "/zig/foo", pool));
+  SVN_ERR(svn_fs_txn_prop(&txn_svn_date, txn, SVN_PROP_REVISION_DATE, pool));
+  SVN_TEST_ASSERT(txn_svn_date);
+  sleep_for_timestamps();
+  SVN_ERR(svn_fs_commit_txn(NULL, &rev, txn, pool));
+
+  SVN_ERR(svn_fs_revision_proplist(&proplist, fs, rev, pool));
+  svn_date = apr_hash_get(proplist, SVN_PROP_REVISION_DATE,
+                          APR_HASH_KEY_STRING);
+  SVN_TEST_ASSERT(svn_date);
+  SVN_TEST_ASSERT(!svn_string_compare(svn_date, txn_svn_date));
+
+  /* Commit that instructs the backend to use a specific svn:date, but
+   * doesn't provide one.  This used to fail with BDB prior to r1663697. */
+  SVN_ERR(svn_fs_begin_txn2(&txn, fs, rev, SVN_FS_TXN_CLIENT_DATE, pool));
+  SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+  SVN_ERR(svn_fs_make_dir(txn_root, "/zig/bar", pool));
+  SVN_ERR(svn_fs_txn_prop(&txn_svn_date, txn, SVN_PROP_REVISION_DATE, pool));
+  SVN_TEST_ASSERT(txn_svn_date);
+  sleep_for_timestamps();
+  SVN_ERR(svn_fs_commit_txn(NULL, &rev, txn, pool));
+
+  SVN_ERR(svn_fs_revision_proplist(&proplist, fs, rev, pool));
+  svn_date = apr_hash_get(proplist, SVN_PROP_REVISION_DATE,
+                          APR_HASH_KEY_STRING);
+  SVN_TEST_ASSERT(svn_date);
+  SVN_TEST_ASSERT(!svn_string_compare(svn_date, txn_svn_date));
+
   return SVN_NO_ERROR;
 }