You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/07/26 13:35:33 UTC

svn commit: r1507265 - in /subversion/branches/fsfs-format7/subversion/libsvn_fs_x: transaction.c transaction.h tree.c tree.h

Author: stefan2
Date: Fri Jul 26 11:35:32 2013
New Revision: 1507265

URL: http://svn.apache.org/r1507265
Log:
On the fsfs-format7 branch:  Replicate the FS commit API change
from FSFS in FSX.

* subversion/libsvn_fs_x/tree.h
  (svn_fs_x__commit_txn): add set_timestamp parameter

* subversion/libsvn_fs_x/transaction.h
  (svn_fs_x__commit): ditto

* subversion/libsvn_fs_x/tree.c
  (svn_fs_x__commit_txn): pass through

* subversion/libsvn_fs_x/transaction.c
  (commit_baton): add set_timestamp member
  (commit_body): set svn:date TXN property only if set_timestamp is true
  (svn_fs_x__commit): pass through via baton 

Modified:
    subversion/branches/fsfs-format7/subversion/libsvn_fs_x/transaction.c
    subversion/branches/fsfs-format7/subversion/libsvn_fs_x/transaction.h
    subversion/branches/fsfs-format7/subversion/libsvn_fs_x/tree.c
    subversion/branches/fsfs-format7/subversion/libsvn_fs_x/tree.h

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_x/transaction.c?rev=1507265&r1=1507264&r2=1507265&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_x/transaction.c Fri Jul 26 11:35:32 2013
@@ -2819,6 +2819,7 @@ struct commit_baton {
   svn_revnum_t *new_rev_p;
   svn_fs_t *fs;
   svn_fs_txn_t *txn;
+  svn_boolean_t set_timestamp;
   apr_array_header_t *reps_to_cache;
   apr_hash_t *reps_hash;
   apr_pool_t *reps_pool;
@@ -2844,7 +2845,6 @@ commit_body(void *baton, apr_pool_t *poo
   apr_hash_t *txnprops;
   apr_array_header_t *txnprop_list;
   svn_prop_t prop;
-  svn_string_t date;
   const svn_fs_x__id_part_t *txn_id = svn_fs_x__txn_get_id(cb->txn);
 
   /* Get the current youngest revision. */
@@ -2968,12 +2968,18 @@ commit_body(void *baton, apr_pool_t *poo
      remove the transaction directory later. */
   SVN_ERR(unlock_proto_rev(cb->fs, txn_id, proto_file_lockcookie, pool));
 
-  /* Update commit time to ensure that svn:date revprops remain ordered. */
-  date.data = svn_time_to_cstring(apr_time_now(), pool);
-  date.len = strlen(date.data);
+  /* Update commit time to ensure that svn:date revprops remain ordered if
+     requested. */
+  if (cb->set_timestamp)
+    {
+      svn_string_t date;
+
+      date.data = svn_time_to_cstring(apr_time_now(), pool);
+      date.len = strlen(date.data);
 
-  SVN_ERR(svn_fs_x__change_txn_prop(cb->txn, SVN_PROP_REVISION_DATE,
-                                     &date, pool));
+      SVN_ERR(svn_fs_x__change_txn_prop(cb->txn, SVN_PROP_REVISION_DATE,
+                                        &date, pool));
+    }
 
   /* Move the revprops file into place. */
   SVN_ERR_ASSERT(! svn_fs_x__is_packed_revprop(cb->fs, new_rev));
@@ -3026,6 +3032,7 @@ svn_error_t *
 svn_fs_x__commit(svn_revnum_t *new_rev_p,
                  svn_fs_t *fs,
                  svn_fs_txn_t *txn,
+                 svn_boolean_t set_timestamp,
                  apr_pool_t *pool)
 {
   struct commit_baton cb;
@@ -3034,6 +3041,7 @@ svn_fs_x__commit(svn_revnum_t *new_rev_p
   cb.new_rev_p = new_rev_p;
   cb.fs = fs;
   cb.txn = txn;
+  cb.set_timestamp = set_timestamp;
 
   if (ffd->rep_sharing_allowed)
     {

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_x/transaction.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_x/transaction.h?rev=1507265&r1=1507264&r2=1507265&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_x/transaction.h (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_x/transaction.h Fri Jul 26 11:35:32 2013
@@ -209,12 +209,14 @@ svn_fs_x__set_proplist(svn_fs_t *fs,
 
 /* Commit the transaction TXN in filesystem FS and return its new
    revision number in *REV.  If the transaction is out of date, return
-   the error SVN_ERR_FS_TXN_OUT_OF_DATE.  Use POOL for temporary
-   allocations. */
+   the error SVN_ERR_FS_TXN_OUT_OF_DATE. Update commit time to ensure that
+   svn:date revprops remain ordered if SET_TIMESTAMP is non-zero. Use POOL
+   for temporary allocations. */
 svn_error_t *
 svn_fs_x__commit(svn_revnum_t *new_rev_p,
                  svn_fs_t *fs,
                  svn_fs_txn_t *txn,
+                 svn_boolean_t set_timestamp,
                  apr_pool_t *pool);
 
 /* Set *NAMES_P to an array of names which are all the active

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_x/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_x/tree.c?rev=1507265&r1=1507264&r2=1507265&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_x/tree.c Fri Jul 26 11:35:32 2013
@@ -1970,6 +1970,7 @@ svn_error_t *
 svn_fs_x__commit_txn(const char **conflict_p,
                      svn_revnum_t *new_rev,
                      svn_fs_txn_t *txn,
+                     svn_boolean_t set_timestamp,
                      apr_pool_t *pool)
 {
   /* How do commits work in Subversion?
@@ -2066,7 +2067,7 @@ svn_fs_x__commit_txn(const char **confli
       txn->base_rev = youngish_rev;
 
       /* Try to commit. */
-      err = svn_fs_x__commit(new_rev, fs, txn, iterpool);
+      err = svn_fs_x__commit(new_rev, fs, txn, set_timestamp, iterpool);
       if (err && (err->apr_err == SVN_ERR_FS_TXN_OUT_OF_DATE))
         {
           /* Did someone else finish committing a new revision while we

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_x/tree.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_x/tree.h?rev=1507265&r1=1507264&r2=1507265&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_x/tree.h (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_x/tree.h Fri Jul 26 11:35:32 2013
@@ -48,10 +48,12 @@ svn_error_t *svn_fs_x__deltify(svn_fs_t 
 /* Commit the transaction TXN as a new revision.  Return the new
    revision in *NEW_REV.  If the transaction conflicts with other
    changes return SVN_ERR_FS_CONFLICT and set *CONFLICT_P to a string
-   that details the cause of the conflict.  Perform temporary
-   allocations in POOL. */
+   that details the cause of the conflict.
+   Update commit time to ensure that svn:date revprops remain ordered if
+   SET_TIMESTAMP is non-zero. Perform temporary allocations in POOL. */
 svn_error_t *svn_fs_x__commit_txn(const char **conflict_p,
                                   svn_revnum_t *new_rev, svn_fs_txn_t *txn,
+                                  svn_boolean_t set_timestamp,
                                   apr_pool_t *pool);
 
 /* Set ROOT_P to the root directory of transaction TXN.  Allocate the