subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1657129 - in /subversion/trunk/subversion/libsvn_fs_x: dag.c dag.h tree.c
Date Wed, 04 Feb 2015 11:58:31 GMT
Author: stefan2
Date: Wed Feb  4 11:58:31 2015
New Revision: 1657129

URL: http://svn.apache.org/r1657129
Log:
In FSX, get rid of redundant DAG root node creation code.  The various
functions may have had very different logic behind them in BDB, but in
FSX, they are basically the same.

* subversion/libsvn_fs_x/dag.h
  (svn_fs_x__dag_txn_root): Remove BDB-related part of the docstring.
  (svn_fs_x__dag_txn_base_root,
   svn_fs_x__dag_clone_root): Drop these functions.

* subversion/libsvn_fs_x/dag.c
  (svn_fs_x__dag_revision_root): Construct DAG nodes for revision roots
                                 the same way we do for txn roots. 
  (svn_fs_x__dag_txn_base_root,
   svn_fs_x__dag_clone_root): Remove.

* subversion/libsvn_fs_x/tree.c
  (mutable_root_node): Simply construct the txn DAG root node which is
                       what svn_fs_x__dag_clone_root did before.
  (merge_changes): Expand the former svn_fs_x__dag_txn_base_root here.

Modified:
    subversion/trunk/subversion/libsvn_fs_x/dag.c
    subversion/trunk/subversion/libsvn_fs_x/dag.h
    subversion/trunk/subversion/libsvn_fs_x/tree.c

Modified: subversion/trunk/subversion/libsvn_fs_x/dag.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/dag.c?rev=1657129&r1=1657128&r2=1657129&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/dag.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/dag.c Wed Feb  4 11:58:31 2015
@@ -656,25 +656,10 @@ svn_fs_x__dag_revision_root(dag_node_t *
                             svn_revnum_t rev,
                             apr_pool_t *result_pool)
 {
-  dag_node_t *new_node;
+  svn_fs_x__id_t root_id;
 
-  /* Construct the node. */
-  new_node = apr_pcalloc(result_pool, sizeof(*new_node));
-  new_node->fs = fs;
-  new_node->revision = rev;
-  svn_fs_x__init_rev_root(&new_node->id, rev);
-
-  /* Grab the contents so we can inspect the node's kind and created path. */
-  new_node->node_pool = result_pool;
-
-  /* Initialize the KIND and CREATED_PATH attributes */
-  new_node->kind = svn_node_dir;
-  new_node->created_path = "/";
-  new_node->hint = APR_SIZE_MAX;
-
-  /* Return a fresh new node */
-  *node_p = new_node;
-  return SVN_NO_ERROR;
+  svn_fs_x__init_rev_root(&root_id, rev);
+  return svn_fs_x__dag_get_node(node_p, fs, &root_id, result_pool);
 }
 
 
@@ -692,23 +677,6 @@ svn_fs_x__dag_txn_root(dag_node_t **node
 
 
 svn_error_t *
-svn_fs_x__dag_txn_base_root(dag_node_t **node_p,
-                            svn_fs_t *fs,
-                            svn_fs_x__txn_id_t txn_id,
-                            apr_pool_t *result_pool,
-                            apr_pool_t *scratch_pool)
-{
-  svn_fs_x__id_t base_root_id;
-  svn_revnum_t base_rev;
-
-  SVN_ERR(svn_fs_x__get_base_rev(&base_rev, fs, txn_id, scratch_pool));
-
-  svn_fs_x__init_rev_root(&base_root_id, base_rev);
-  return svn_fs_x__dag_get_node(node_p, fs, &base_root_id, result_pool);
-}
-
-
-svn_error_t *
 svn_fs_x__dag_clone_child(dag_node_t **child_p,
                           dag_node_t *parent,
                           const char *parent_path,
@@ -791,21 +759,6 @@ svn_fs_x__dag_clone_child(dag_node_t **c
 }
 
 
-
-svn_error_t *
-svn_fs_x__dag_clone_root(dag_node_t **root_p,
-                         svn_fs_t *fs,
-                         svn_fs_x__txn_id_t txn_id,
-                         apr_pool_t *result_pool)
-{
-  svn_fs_x__id_t root_id;
-  svn_fs_x__init_txn_root(&root_id, txn_id);
-
-  /* One way or another, root_id now identifies a cloned root node. */
-  return svn_fs_x__dag_get_node(root_p, fs, &root_id, result_pool);
-}
-
-
 /* Delete all mutable node revisions reachable from node ID, including
    ID itself, from FS's `nodes' table.  Also delete any mutable
    representations and strings associated with that node revision.

Modified: subversion/trunk/subversion/libsvn_fs_x/dag.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/dag.h?rev=1657129&r1=1657128&r2=1657129&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/dag.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/dag.h Wed Feb  4 11:58:31 2015
@@ -261,41 +261,13 @@ svn_fs_x__dag_revision_root(dag_node_t *
 
 
 /* Set *NODE_P to the root of transaction TXN_ID in FS, allocating
-   from RESULT_POOL.
-
-   Note that the root node of TXN_ID is not necessarily mutable.  If
-   no changes have been made in the transaction, then it may share its
-   root directory with its base revision.  To get a mutable root node
-   for a transaction, call svn_fs_x__dag_clone_root.  */
+   from RESULT_POOL. */
 svn_error_t *
 svn_fs_x__dag_txn_root(dag_node_t **node_p,
                        svn_fs_t *fs,
                        svn_fs_x__txn_id_t txn_id,
                        apr_pool_t *result_pool);
 
-
-/* Set *NODE_P to the base root of transaction TXN_ID in FS,
-   allocating from RESULT_POOL.  Allocate the node in TRAIL->pool.
-   Use SCRATCH_POOL for temporaries. */
-svn_error_t *
-svn_fs_x__dag_txn_base_root(dag_node_t **node_p,
-                            svn_fs_t *fs,
-                            svn_fs_x__txn_id_t txn_id,
-                            apr_pool_t *result_pool,
-                            apr_pool_t *scratch_pool);
-
-
-/* Clone the root directory of TXN_ID in FS, and update the
-   `transactions' table entry to point to it, unless this has been
-   done already.  In either case, set *ROOT_P to a reference to the
-   root directory clone.  Allocate *ROOT_P in RESULT_POOL.  */
-svn_error_t *
-svn_fs_x__dag_clone_root(dag_node_t **root_p,
-                         svn_fs_t *fs,
-                         svn_fs_x__txn_id_t txn_id,
-                         apr_pool_t *result_pool);
-
-
 
 /* Directories.  */
 

Modified: subversion/trunk/subversion/libsvn_fs_x/tree.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/tree.c?rev=1657129&r1=1657128&r2=1657129&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/tree.c Wed Feb  4 11:58:31 2015
@@ -598,8 +598,8 @@ mutable_root_node(dag_node_t **node_p,
   if (root->is_txn_root)
     {
       /* It's a transaction root.  Open a fresh copy.  */
-      return svn_fs_x__dag_clone_root(node_p, root->fs, root_txn_id(root),
-                                      result_pool);
+      return svn_fs_x__dag_txn_root(node_p, root->fs, root_txn_id(root),
+                                    result_pool);
     }
   else
     /* If it's not a transaction root, we can't change its contents.  */
@@ -2111,8 +2111,10 @@ merge_changes(dag_node_t *ancestor_node,
 
   if (ancestor_node == NULL)
     {
-      SVN_ERR(svn_fs_x__dag_txn_base_root(&ancestor_node, fs, txn_id,
-                                          scratch_pool, scratch_pool));
+      svn_revnum_t base_rev;
+      SVN_ERR(svn_fs_x__get_base_rev(&base_rev, fs, txn_id, scratch_pool));
+      SVN_ERR(svn_fs_x__dag_revision_root(&ancestor_node, fs, base_rev,
+                                          scratch_pool));
     }
 
   SVN_ERR(svn_fs_x__dag_related_node(&related, ancestor_node, txn_root_node));



Mime
View raw message