Author: stefan2
Date: Wed Oct  8 11:06:11 2014
New Revision: 1630070

URL: http://svn.apache.org/r1630070
Log:
Introduce path construction utilities for the 'transactions' and
'txn-protorevs' directory in FSFS repositories.

* subversion/libsvn_fs_fs/util.h
  (svn_fs_fs__path_txns_dir,
   svn_fs_fs__path_txn_proto_revs): Declare new private API.

* subversion/libsvn_fs_fs/util.c
  (svn_fs_fs__path_txns_dir): Implement new private API.
  (svn_fs_fs__path_txn_dir): Use the new function.
  (svn_fs_fs__path_txn_proto_revs): Implement new private API.
  (svn_fs_fs__path_txn_proto_rev,
   svn_fs_fs__path_txn_proto_rev_lock): Use the new function.

* subversion/libsvn_fs_fs/fs_fs.c
  (upgrade_body,
   svn_fs_fs__create_file_tree): Use the new path constructors.

* subversion/libsvn_fs_fs/transaction.c
  (create_txn_dir_pre_1_5,
   svn_fs_fs__list_transactions): Same.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
    subversion/trunk/subversion/libsvn_fs_fs/transaction.c
    subversion/trunk/subversion/libsvn_fs_fs/util.c
    subversion/trunk/subversion/libsvn_fs_fs/util.h

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1630070&r1=1630069&r2=1630070&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Wed Oct  8 11:06:11 2014
@@ -1220,10 +1220,8 @@ upgrade_body(void *baton, apr_pool_t *po
      dir, make that directory.  */
   if (format < SVN_FS_FS__MIN_PROTOREVS_DIR_FORMAT)
     {
-      /* We don't use path_txn_proto_rev() here because it expects
-         we've already bumped our format. */
       SVN_ERR(svn_io_make_dir_recursively(
-          svn_dirent_join(fs->path, PATH_TXN_PROTOS_DIR, pool), pool));
+          svn_fs_fs__path_txn_proto_revs(fs, pool), pool));
     }
 
   /* If our filesystem is new enough, write the min unpacked rev file. */
@@ -1716,14 +1714,13 @@ svn_fs_fs__create_file_tree(svn_fs_t *fs
                                         pool));
 
   /* Create the transaction directory. */
-  SVN_ERR(svn_io_make_dir_recursively(svn_dirent_join(path, PATH_TXNS_DIR,
-                                                      pool),
+  SVN_ERR(svn_io_make_dir_recursively(svn_fs_fs__path_txns_dir(fs, pool),
                                       pool));
 
   /* Create the protorevs directory. */
   if (format >= SVN_FS_FS__MIN_PROTOREVS_DIR_FORMAT)
-    SVN_ERR(svn_io_make_dir_recursively(svn_dirent_join(path, 
PATH_TXN_PROTOS_DIR,
-                                                      pool),
+    SVN_ERR(svn_io_make_dir_recursively(svn_fs_fs__path_txn_proto_revs(fs,
+                                                                       pool),
                                         pool));
 
   /* Create the 'current' file. */

Modified: subversion/trunk/subversion/libsvn_fs_fs/transaction.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/transaction.c?rev=1630070&r1=1630069&r2=1630070&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/transaction.c Wed Oct  8 11:06:11 
2014
@@ -1019,8 +1019,8 @@ create_txn_dir_pre_1_5(const char **id_p
   const char *unique_path, *prefix;
 
   /* Try to create directories named "<txndir>/<rev>-<uniqueifier>.txn". */
-  prefix = svn_dirent_join_many(pool, fs->path, PATH_TXNS_DIR,
-                                apr_psprintf(pool, "%ld", rev), SVN_VA_NULL);
+  prefix = svn_dirent_join(svn_fs_fs__path_txns_dir(fs, pool),
+                           apr_psprintf(pool, "%ld", rev), pool);
 
   subpool = svn_pool_create(pool);
   for (i = 1; i <= 99999; i++)
@@ -3898,7 +3898,7 @@ svn_fs_fs__list_transactions(apr_array_h
   names = apr_array_make(pool, 1, sizeof(const char *));
 
   /* Get the transactions directory. */
-  txn_dir = svn_dirent_join(fs->path, PATH_TXNS_DIR, pool);
+  txn_dir = svn_fs_fs__path_txns_dir(fs, pool);
 
   /* Now find a listing of this directory. */
   SVN_ERR(svn_io_get_dirents3(&dirents, txn_dir, TRUE, pool, pool));

Modified: subversion/trunk/subversion/libsvn_fs_fs/util.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/util.c?rev=1630070&r1=1630069&r2=1630070&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/util.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/util.c Wed Oct  8 11:06:11 2014
@@ -234,15 +234,21 @@ combine_txn_id_string(const svn_fs_fs__i
 }
 
 const char *
+svn_fs_fs__path_txns_dir(svn_fs_t *fs,
+                         apr_pool_t *pool)
+{
+  return svn_dirent_join(fs->path, PATH_TXNS_DIR, pool);
+}
+
+const char *
 svn_fs_fs__path_txn_dir(svn_fs_t *fs,
                         const svn_fs_fs__id_part_t *txn_id,
                         apr_pool_t *pool)
 {
   SVN_ERR_ASSERT_NO_RETURN(txn_id != NULL);
-  return svn_dirent_join_many(pool, fs->path, PATH_TXNS_DIR,
-                              combine_txn_id_string(txn_id, PATH_EXT_TXN,
-                                                    pool),
-                              SVN_VA_NULL);
+  return svn_dirent_join(svn_fs_fs__path_txns_dir(fs, pool),
+                         combine_txn_id_string(txn_id, PATH_EXT_TXN, pool),
+                         pool);
 }
 
 const char*
@@ -273,16 +279,22 @@ svn_fs_fs__path_txn_item_index(svn_fs_t 
 }
 
 const char *
+svn_fs_fs__path_txn_proto_revs(svn_fs_t *fs,
+                               apr_pool_t *pool)
+{
+  return svn_dirent_join(fs->path, PATH_TXN_PROTOS_DIR, pool);
+}
+
+const char *
 svn_fs_fs__path_txn_proto_rev(svn_fs_t *fs,
                               const svn_fs_fs__id_part_t *txn_id,
                               apr_pool_t *pool)
 {
   fs_fs_data_t *ffd = fs->fsap_data;
   if (ffd->format >= SVN_FS_FS__MIN_PROTOREVS_DIR_FORMAT)
-    return svn_dirent_join_many(pool, fs->path, PATH_TXN_PROTOS_DIR,
-                                combine_txn_id_string(txn_id, PATH_EXT_REV,
-                                                      pool),
-                                SVN_VA_NULL);
+    return svn_dirent_join(svn_fs_fs__path_txn_proto_revs(fs, pool),
+                           combine_txn_id_string(txn_id, PATH_EXT_REV, pool),
+                           pool);
   else
     return svn_dirent_join(svn_fs_fs__path_txn_dir(fs, txn_id, pool),
                            PATH_REV, pool);
@@ -296,11 +308,10 @@ svn_fs_fs__path_txn_proto_rev_lock(svn_f
 {
   fs_fs_data_t *ffd = fs->fsap_data;
   if (ffd->format >= SVN_FS_FS__MIN_PROTOREVS_DIR_FORMAT)
-    return svn_dirent_join_many(pool, fs->path, PATH_TXN_PROTOS_DIR,
-                                combine_txn_id_string(txn_id,
-                                                      PATH_EXT_REV_LOCK,
-                                                      pool),
-                                SVN_VA_NULL);
+    return svn_dirent_join(svn_fs_fs__path_txn_proto_revs(fs, pool),
+                           combine_txn_id_string(txn_id, PATH_EXT_REV_LOCK,
+                                                 pool),
+                           pool);
   else
     return svn_dirent_join(svn_fs_fs__path_txn_dir(fs, txn_id, pool),
                            PATH_REV_LOCK, pool);

Modified: subversion/trunk/subversion/libsvn_fs_fs/util.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/util.h?rev=1630070&r1=1630069&r2=1630070&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/util.h (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/util.h Wed Oct  8 11:06:11 2014
@@ -189,6 +189,13 @@ const char *
 svn_fs_fs__path_min_unpacked_rev(svn_fs_t *fs,
                                  apr_pool_t *pool);
 
+/* Return the path of the 'transactions' directory in FS.
+ * The result will be allocated in POOL.
+ */
+const char *
+svn_fs_fs__path_txns_dir(svn_fs_t *fs,
+                         apr_pool_t *pool);
+
 /* Return the path of the directory containing the transaction TXN_ID in FS.
  * The result will be allocated in POOL.
  */
@@ -197,6 +204,13 @@ svn_fs_fs__path_txn_dir(svn_fs_t *fs,
                         const svn_fs_fs__id_part_t *txn_id,
                         apr_pool_t *pool);
 
+/* Return the path of the 'txn-protorevs' directory in FS, even if that
+ * folder may not exist in FS.  The result will be allocated in POOL.
+ */
+const char *
+svn_fs_fs__path_txn_proto_revs(svn_fs_t *fs,
+                               apr_pool_t *pool);
+
 /* Return the path of the proto-revision file for transaction TXN_ID in FS.
  * The result will be allocated in POOL.
  */


Reply via email to