subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1661382 - in /subversion/branches/fsx-1.10/subversion/libsvn_fs_x: dag.c dag.h dag_cache.c tree.c tree.h
Date Sat, 21 Feb 2015 15:39:06 GMT
Author: stefan2
Date: Sat Feb 21 15:39:05 2015
New Revision: 1661382

URL: http://svn.apache.org/r1661382
Log:
On the fsx-1.10 branch:
Unify the FSX DAG root node creation functions, i.e. no longer have
separate variants for revision and txn roots.  Since the introduction
of the concept of "change sets", both, caller and implementation look
almost identical already.

* subversion/libsvn_fs_x/dag.h
  (svn_fs_x__dag_revision_root,
   svn_fs_x__dag_txn_root): Remove and replace by ...
  (svn_fs_x__dag_root): ... this.

* subversion/libsvn_fs_x/dag.c
  (svn_fs_x__dag_revision_root,
   svn_fs_x__dag_txn_root): Remove and replace by ...
  (svn_fs_x__dag_root): ... this.

* subversion/libsvn_fs_x/tree.h
  (svn_fs_x__root_node): Remove this redundant function.

* subversion/libsvn_fs_x/tree.c
  (svn_fs_x__root_node): Remove this redundant function.
  (merge_changes,
   svn_fs_x__verify_root): Directly call the new generic DAG function.

* subversion/libsvn_fs_x/dag_cache.c
  (get_root_node): Same.
  (mutable_root_node): Move down and call the common root provider function.
  (svn_fs_x__get_dag_path): Call the common root provider function.

Modified:
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.c
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.h
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.h

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.c?rev=1661382&r1=1661381&r2=1661382&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.c Sat Feb 21 15:39:05 2015
@@ -543,30 +543,16 @@ svn_fs_x__dag_set_has_mergeinfo(dag_node
 /*** Roots. ***/
 
 svn_error_t *
-svn_fs_x__dag_revision_root(dag_node_t **node_p,
-                            svn_fs_t *fs,
-                            svn_revnum_t rev,
-                            apr_pool_t *result_pool,
-                            apr_pool_t *scratch_pool)
+svn_fs_x__dag_root(dag_node_t **node_p,
+                   svn_fs_t *fs,
+                   svn_fs_x__change_set_t change_set,
+                   apr_pool_t *result_pool,
+                   apr_pool_t *scratch_pool)
 {
   svn_fs_x__id_t root_id;
+  root_id.change_set = change_set;
+  root_id.number = SVN_FS_X__ITEM_INDEX_ROOT_NODE;
 
-  svn_fs_x__init_rev_root(&root_id, rev);
-  return svn_fs_x__dag_get_node(node_p, fs, &root_id, result_pool,
-                                scratch_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,
-                       apr_pool_t *scratch_pool)
-{
-  svn_fs_x__id_t root_id;
-
-  svn_fs_x__init_txn_root(&root_id, txn_id);
   return svn_fs_x__dag_get_node(node_p, fs, &root_id, result_pool,
                                 scratch_pool);
 }

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.h?rev=1661382&r1=1661381&r2=1661382&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.h (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag.h Sat Feb 21 15:39:05 2015
@@ -222,25 +222,15 @@ svn_fs_x__dag_set_has_mergeinfo(dag_node
 /* Revision and transaction roots.  */
 
 
-/* Open the root of revision REV of filesystem FS, allocating from
+/* Open the root of change set CHANGE_SET of filesystem FS, allocating from
    RESULT_POOL.  Set *NODE_P to the new node.  Use SCRATCH_POOL for
    temporary allocations.*/
 svn_error_t *
-svn_fs_x__dag_revision_root(dag_node_t **node_p,
-                            svn_fs_t *fs,
-                            svn_revnum_t rev,
-                            apr_pool_t *result_pool,
-                            apr_pool_t *scratch_pool);
-
-
-/* Set *NODE_P to the root of transaction TXN_ID in FS, allocating
-   from RESULT_POOL.  Use SCRATCH_POOL for temporary allocations. */
-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,
-                       apr_pool_t *scratch_pool);
+svn_fs_x__dag_root(dag_node_t **node_p,
+                   svn_fs_t *fs,
+                   svn_fs_x__change_set_t change_set,
+                   apr_pool_t *result_pool,
+                   apr_pool_t *scratch_pool);
 
 
 /* Directories.  */

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c?rev=1661382&r1=1661381&r2=1661382&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c Sat Feb 21 15:39:05 2015
@@ -488,29 +488,6 @@ svn_fs_x__invalidate_dag_cache(svn_fs_ro
 
 /* Getting dag nodes for roots.  */
 
-/* Set *NODE_P to a mutable root directory for ROOT, cloning if
-   necessary, allocating in RESULT_POOL.  ROOT must be a transaction root.
-   Use ERROR_PATH in error messages.  Use SCRATCH_POOL for temporaries.*/
-static svn_error_t *
-mutable_root_node(dag_node_t **node_p,
-                  svn_fs_root_t *root,
-                  const char *error_path,
-                  apr_pool_t *result_pool,
-                  apr_pool_t *scratch_pool)
-{
-  if (root->is_txn_root)
-    {
-      /* It's a transaction root.  Open a fresh copy.  */
-      return svn_fs_x__dag_txn_root(node_p, root->fs,
-                                    svn_fs_x__root_txn_id(root),
-                                    result_pool, scratch_pool);
-    }
-  else
-    /* If it's not a transaction root, we can't change its contents.  */
-    return SVN_FS__ERR_NOT_MUTABLE(root->fs, root->rev, error_path);
-}
-
-
 
 /* Traversing directory paths.  */
 
@@ -664,8 +641,8 @@ get_root_node(dag_node_t **node_p,
   /* If it is not already cached, construct the DAG node object for NODE_ID.
      Let it live in the cache.  Sadly, we often can't reuse txn DAG nodes. */
   if (bucket->node == NULL)
-    SVN_ERR(svn_fs_x__root_node(&bucket->node, root,
-                                ffd->dag_node_cache->pool, scratch_pool));
+    SVN_ERR(svn_fs_x__dag_root(&bucket->node, fs, change_set,
+                               ffd->dag_node_cache->pool, scratch_pool));
 
   /* Return a reference to the cached object. */
   *node_p = bucket->node;
@@ -906,7 +883,7 @@ svn_fs_x__get_dag_path(svn_fs_x__dag_pat
   normalize_path(&path, fs_path); /* "" */
 
   /* Make a DAG_PATH for the root node, using its own current copy id.  */
-  SVN_ERR(svn_fs_x__root_node(&here, root, pool, iterpool));
+  SVN_ERR(get_root_node(&here, root, change_set, iterpool));
   dag_path = make_parent_path(here, entry_buffer, NULL, pool);
   dag_path->copy_inherit = svn_fs_x__copy_id_inherit_self;
 
@@ -969,6 +946,28 @@ svn_fs_x__get_dag_path(svn_fs_x__dag_pat
   return SVN_NO_ERROR;
 }
 
+/* Set *NODE_P to a mutable root directory for ROOT, cloning if
+   necessary, allocating in RESULT_POOL.  ROOT must be a transaction root.
+   Use ERROR_PATH in error messages.  Use SCRATCH_POOL for temporaries.*/
+static svn_error_t *
+mutable_root_node(dag_node_t **node_p,
+                  svn_fs_root_t *root,
+                  const char *error_path,
+                  apr_pool_t *result_pool,
+                  apr_pool_t *scratch_pool)
+{
+  /* If it's not a transaction root, we can't change its contents.  */
+  if (!root->is_txn_root)
+    return SVN_FS__ERR_NOT_MUTABLE(root->fs, root->rev, error_path);
+
+  /* It's a transaction root.
+     Get the appropriate DAG root node and copy it into RESULT_POOL. */
+  SVN_ERR(get_root_node(node_p, root, svn_fs_x__root_change_set(root),
+                        scratch_pool));
+  *node_p = svn_fs_x__dag_dup(*node_p, result_pool);
+
+  return SVN_NO_ERROR;
+}
 
 svn_error_t *
 svn_fs_x__make_path_mutable(svn_fs_root_t *root,

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c?rev=1661382&r1=1661381&r2=1661382&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c Sat Feb 21 15:39:05 2015
@@ -178,30 +178,6 @@ svn_fs_x__root_change_set(svn_fs_root_t
   return svn_fs_x__change_set_by_rev(root->rev);
 }
 
-/* Set *NODE_P to a freshly opened dag node referring to the root
-   directory of ROOT, allocating from RESULT_POOL.  Use SCRATCH_POOL
-   for temporary allocations.  */
-svn_error_t *
-svn_fs_x__root_node(dag_node_t **node_p,
-                    svn_fs_root_t *root,
-                    apr_pool_t *result_pool,
-                    apr_pool_t *scratch_pool)
-{
-  if (root->is_txn_root)
-    {
-      /* It's a transaction root.  Open a fresh copy.  */
-      return svn_fs_x__dag_txn_root(node_p, root->fs,
-                                    svn_fs_x__root_txn_id(root),
-                                    result_pool, scratch_pool);
-    }
-  else
-    {
-      /* It's a revision root, so we already have its root directory
-         opened.  */
-      return svn_fs_x__dag_revision_root(node_p, root->fs, root->rev,
-                                         result_pool, scratch_pool);
-    }
-}
 
 
 
@@ -1096,15 +1072,17 @@ merge_changes(dag_node_t *ancestor_node,
   svn_fs_t *fs = txn->fs;
   svn_fs_x__txn_id_t txn_id = svn_fs_x__txn_get_id(txn);
 
-  SVN_ERR(svn_fs_x__dag_txn_root(&txn_root_node, fs, txn_id, scratch_pool,
-                                 scratch_pool));
+  SVN_ERR(svn_fs_x__dag_root(&txn_root_node, fs,
+                             svn_fs_x__change_set_by_txn(txn_id),
+                             scratch_pool, scratch_pool));
 
   if (ancestor_node == NULL)
     {
       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, scratch_pool));
+      SVN_ERR(svn_fs_x__dag_root(&ancestor_node, fs,
+                                 svn_fs_x__change_set_by_rev(base_rev),
+                                 scratch_pool, scratch_pool));
     }
 
   if (!svn_fs_x__dag_related_node(ancestor_node, txn_root_node))
@@ -3419,7 +3397,9 @@ svn_fs_x__verify_root(svn_fs_root_t *roo
      When this code is called in the library, we want to ensure we
      use the on-disk data --- rather than some data that was read
      in the possibly-distance past and cached since. */
-  SVN_ERR(svn_fs_x__root_node(&root_dir, root, scratch_pool, scratch_pool));
+  SVN_ERR(svn_fs_x__dag_root(&root_dir, root->fs,
+                             svn_fs_x__root_change_set(root),
+                             scratch_pool, scratch_pool));
 
   /* Recursively verify ROOT_DIR. */
   parent_nodes = apr_array_make(scratch_pool, 16, sizeof(dag_node_t *));

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.h?rev=1661382&r1=1661381&r2=1661382&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.h (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.h Sat Feb 21 15:39:05 2015
@@ -40,15 +40,6 @@ svn_fs_x__root_txn_id(svn_fs_root_t *roo
 svn_fs_x__change_set_t
 svn_fs_x__root_change_set(svn_fs_root_t *root);
 
-/* Set *NODE_P to a freshly opened dag node referring to the root
-   directory of ROOT, allocating from RESULT_POOL.  Use SCRATCH_POOL
-   for temporary allocations.  */
-svn_error_t *
-svn_fs_x__root_node(dag_node_t **node_p,
-                    svn_fs_root_t *root,
-                    apr_pool_t *result_pool,
-                    apr_pool_t *scratch_pool);
-
 /* Set *ROOT_P to the root directory of revision REV in filesystem FS.
    Allocate the structure in POOL. */
 svn_error_t *



Mime
View raw message