subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1568794 - in /subversion/trunk/subversion/libsvn_fs_x: cached_data.c changes.c id.c id.h noderevs.c pack.c transaction.c tree.c
Date Sun, 16 Feb 2014 17:52:14 GMT
Author: stefan2
Date: Sun Feb 16 17:52:14 2014
New Revision: 1568794

URL: http://svn.apache.org/r1568794
Log:
FSX ID API cleanup: name things properly and remove unused functions.

* subversion/libsvn_fs_x/id.h
  (svn_fs_x__id_txn_used,
   svn_fs_x__id_txn_reset): Remove unused API function declarations.
  (svn_fs_x__id_rev_item): Rename to ...
  (svn_fs_x__id_noderev_id): ... this unified accessor.
  (svn_fs_x__id_rev_create): Rename to ...
  (svn_fs_x__id_create): ... this and name the noderev_id parameter as such.
                         This is now a unified rev / txn creator function.

* subversion/libsvn_fs_x/id.c
  (svn_fs_x__id_txn_used,
   svn_fs_x__id_txn_reset): Remove.
  (svn_fs_x__id_rev_item): Rename to ...
  (svn_fs_x__id_noderev_id): ... this.  Always return the id part because
                             this is now the unified accessor.
  (svn_fs_x__id_rev_create): Rename to ...
  (svn_fs_x__id_create): ... this and update parameter name.

* subversion/libsvn_fs_x/changes.c
  (append_change,
   svn_fs_x__changes_get_list,
   svn_fs_x__read_changes_container,
   svn_fs_x__changes_get_list_func): Simplify using the new unified ID
                                     accessor and constructor API.

* subversion/libsvn_fs_x/noderevs.c
  (binary_id_t): Name noderev_id properly.
  (store_id,
   get_id,
   svn_fs_x__write_noderevs_container,
   svn_fs_x__read_noderevs_container): Update following the struct member
                                       and ID API renames.

* subversion/libsvn_fs_x/cached_data.c
  (get_node_revision_body,
   svn_fs_x__get_node_revision, 
   svn_fs_x__get_mergeinfo_count): API callers follow the rename.

* subversion/libsvn_fs_x/pack.c
  (copy_node_to_temp): Ditto

* subversion/libsvn_fs_x/transaction.c
  (write_final_rev): Same.

* subversion/libsvn_fs_x/tree.c
  (x_node_relation): Same.

Modified:
    subversion/trunk/subversion/libsvn_fs_x/cached_data.c
    subversion/trunk/subversion/libsvn_fs_x/changes.c
    subversion/trunk/subversion/libsvn_fs_x/id.c
    subversion/trunk/subversion/libsvn_fs_x/id.h
    subversion/trunk/subversion/libsvn_fs_x/noderevs.c
    subversion/trunk/subversion/libsvn_fs_x/pack.c
    subversion/trunk/subversion/libsvn_fs_x/transaction.c
    subversion/trunk/subversion/libsvn_fs_x/tree.c

Modified: subversion/trunk/subversion/libsvn_fs_x/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/cached_data.c?rev=1568794&r1=1568793&r2=1568794&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/cached_data.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/cached_data.c Sun Feb 16 17:52:14 2014
@@ -302,7 +302,7 @@ get_node_revision_body(node_revision_t *
   else
     {
       /* noderevs in rev / pack files can be cached */
-      const svn_fs_x__id_part_t *noderev_id = svn_fs_x__id_rev_item(id);
+      const svn_fs_x__id_part_t *noderev_id = svn_fs_x__id_noderev_id(id);
       svn_revnum_t revision = svn_fs_x__get_revnum(noderev_id->change_set);
       pair_cache_key_t key;
 
@@ -363,7 +363,7 @@ svn_fs_x__get_node_revision(node_revisio
                             const svn_fs_id_t *id,
                             apr_pool_t *pool)
 {
-  const svn_fs_x__id_part_t *noderev_id = svn_fs_x__id_rev_item(id);
+  const svn_fs_x__id_part_t *noderev_id = svn_fs_x__id_noderev_id(id);
 
   svn_error_t *err = get_node_revision_body(noderev_p, fs, id, pool);
   if (err && err->apr_err == SVN_ERR_FS_CORRUPT)
@@ -397,7 +397,7 @@ svn_fs_x__get_mergeinfo_count(apr_int64_
   if (! svn_fs_x__id_is_txn(id))
     {
       /* noderevs in rev / pack files can be cached */
-      const svn_fs_x__id_part_t *noderev_id = svn_fs_x__id_rev_item(id);
+      const svn_fs_x__id_part_t *noderev_id = svn_fs_x__id_noderev_id(id);
       fs_x_data_t *ffd = fs->fsap_data;
       svn_revnum_t revision = svn_fs_x__get_revnum(noderev_id->change_set);
 

Modified: subversion/trunk/subversion/libsvn_fs_x/changes.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/changes.c?rev=1568794&r1=1568793&r2=1568794&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/changes.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/changes.c Sun Feb 16 17:52:14 2014
@@ -181,15 +181,7 @@ append_change(svn_fs_x__changes_t *chang
     {
       binary_change.node_id = *svn_fs_x__id_node_id(info->node_rev_id);
       binary_change.copy_id = *svn_fs_x__id_copy_id(info->node_rev_id);
-      if (is_txn_id)
-        {
-          binary_change.noderev_id.change_set = SVN_FS_X__INVALID_CHANGE_SET;
-          binary_change.noderev_id.number = svn_fs_x__id_txn_id(info->node_rev_id);
-        }
-      else
-        {
-          binary_change.noderev_id = *svn_fs_x__id_rev_item(info->node_rev_id);
-        }
+      binary_change.noderev_id = *svn_fs_x__id_noderev_id(info->node_rev_id);
     }
   else
     {
@@ -282,16 +274,10 @@ svn_fs_x__changes_get_list(apr_array_hea
                                                      pool);
 
       if (binary_change->noderev_id.change_set != SVN_FS_X__INVALID_CHANGE_SET)
-        info->node_rev_id
-          = binary_change->flags & CHANGE_TXN_NODE
-          ? svn_fs_x__id_txn_create(&binary_change->node_id,
-                                    &binary_change->copy_id,
-                                    binary_change->noderev_id.number,
-                                    pool)
-          : svn_fs_x__id_rev_create(&binary_change->node_id,
-                                    &binary_change->copy_id,
-                                    &binary_change->noderev_id,
-                                    pool);
+        info->node_rev_id = svn_fs_x__id_create(&binary_change->node_id,
+                                                &binary_change->copy_id,
+                                                &binary_change->noderev_id,
+                                                pool);
 
       info->change_kind = (svn_fs_path_change_kind_t)
         ((binary_change->flags & CHANGE_KIND_MASK) >> CHANGE_KIND_SHIFT);
@@ -426,11 +412,11 @@ svn_fs_x__read_changes_container(svn_fs_
       change.copyfrom_rev = (svn_revnum_t)svn_packed__get_int(changes_stream);
       change.copyfrom_path = (apr_size_t)svn_packed__get_uint(changes_stream);
 
-      change.node_id.change_set = (svn_revnum_t)svn_packed__get_int(changes_stream);
+      change.node_id.change_set = svn_packed__get_int(changes_stream);
       change.node_id.number = svn_packed__get_uint(changes_stream);
-      change.copy_id.change_set = (svn_revnum_t)svn_packed__get_int(changes_stream);
+      change.copy_id.change_set = svn_packed__get_int(changes_stream);
       change.copy_id.number = svn_packed__get_uint(changes_stream);
-      change.noderev_id.change_set = (svn_revnum_t)svn_packed__get_int(changes_stream);
+      change.noderev_id.change_set = svn_packed__get_int(changes_stream);
       change.noderev_id.number = svn_packed__get_uint(changes_stream);
 
       APR_ARRAY_PUSH(changes->changes, binary_change_t) = change;
@@ -553,16 +539,10 @@ svn_fs_x__changes_get_list_func(void **o
                                           &change->path.len, pool);
 
       if (binary_change->noderev_id.change_set != SVN_FS_X__INVALID_CHANGE_SET)
-        info->node_rev_id
-          = binary_change->flags & CHANGE_TXN_NODE
-          ? svn_fs_x__id_txn_create(&binary_change->node_id,
-                                    &binary_change->copy_id,
-                                    binary_change->noderev_id.number,
-                                    pool)
-          : svn_fs_x__id_rev_create(&binary_change->node_id,
-                                    &binary_change->copy_id,
-                                    &binary_change->noderev_id,
-                                    pool);
+        info->node_rev_id = svn_fs_x__id_create(&binary_change->node_id,
+                                                &binary_change->copy_id,
+                                                &binary_change->noderev_id,
+                                                pool);
 
       info->change_kind = (svn_fs_path_change_kind_t)
         ((binary_change->flags & CHANGE_KIND_MASK) >> CHANGE_KIND_SHIFT);

Modified: subversion/trunk/subversion/libsvn_fs_x/id.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/id.c?rev=1568794&r1=1568793&r2=1568794&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/id.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/id.c Sun Feb 16 17:52:14 2014
@@ -153,18 +153,6 @@ svn_fs_x__id_part_eq(const svn_fs_x__id_
   return lhs->change_set == rhs->change_set && lhs->number == rhs->number;
 }
 
-svn_boolean_t
-svn_fs_x__id_txn_used(svn_fs_x__txn_id_t txn_id)
-{
-  return txn_id != SVN_FS_X__INVALID_TXN_ID;
-}
-
-void
-svn_fs_x__id_txn_reset(svn_fs_x__txn_id_t *txn_id)
-{
-  *txn_id = SVN_FS_X__INVALID_TXN_ID;
-}
-
 
 
 /* Accessing ID Pieces.  */
@@ -197,13 +185,11 @@ svn_fs_x__id_txn_id(const svn_fs_id_t *f
 
 
 const svn_fs_x__id_part_t *
-svn_fs_x__id_rev_item(const svn_fs_id_t *fs_id)
+svn_fs_x__id_noderev_id(const svn_fs_id_t *fs_id)
 {
-  const static svn_fs_x__id_part_t invalid
-    = { SVN_FS_X__INVALID_CHANGE_SET, 0};
   fs_x__id_t *id = (fs_x__id_t *)fs_id;
 
-  return svn_fs_x__id_is_txn(fs_id) ? &invalid : &id->noderev_id;
+  return &id->noderev_id;
 }
 
 svn_revnum_t
@@ -373,16 +359,16 @@ svn_fs_x__id_txn_create(const svn_fs_x__
 
 
 svn_fs_id_t *
-svn_fs_x__id_rev_create(const svn_fs_x__id_part_t *node_id,
-                        const svn_fs_x__id_part_t *copy_id,
-                        const svn_fs_x__id_part_t *rev_item,
-                        apr_pool_t *pool)
+svn_fs_x__id_create(const svn_fs_x__id_part_t *node_id,
+                    const svn_fs_x__id_part_t *copy_id,
+                    const svn_fs_x__id_part_t *noderev_id,
+                    apr_pool_t *pool)
 {
   fs_x__id_t *id = apr_pcalloc(pool, sizeof(*id));
 
   id->node_id = *node_id;
   id->copy_id = *copy_id;
-  id->noderev_id = *rev_item;
+  id->noderev_id = *noderev_id;
 
   id->generic_id.vtable = &id_vtable;
   id->generic_id.fsap_data = id;

Modified: subversion/trunk/subversion/libsvn_fs_x/id.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/id.h?rev=1568794&r1=1568793&r2=1568794&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/id.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/id.h Sun Feb 16 17:52:14 2014
@@ -87,12 +87,6 @@ svn_boolean_t svn_fs_x__id_part_is_root(
 svn_boolean_t svn_fs_x__id_part_eq(const svn_fs_x__id_part_t *lhs,
                                    const svn_fs_x__id_part_t *rhs);
 
-/* Return TRUE, if TXN_ID is used, i.e. doesn't contain just the defaults. */
-svn_boolean_t svn_fs_x__id_txn_used(svn_fs_x__txn_id_t txn_id);
-
-/* Reset TXN_ID to the defaults. */
-void svn_fs_x__id_txn_reset(svn_fs_x__txn_id_t *txn_id);
-
 
 /*** ID accessor functions. ***/
 
@@ -102,11 +96,12 @@ const svn_fs_x__id_part_t *svn_fs_x__id_
 /* Get the "copy id" portion of ID. */
 const svn_fs_x__id_part_t *svn_fs_x__id_copy_id(const svn_fs_id_t *id);
 
-/* Get the "txn id" portion of ID, or NULL if it is a permanent ID. */
+/* Get the "txn id" portion of ID,
+ * or SVN_FS_X__INVALID_TXN_ID if it is a permanent ID. */
 svn_fs_x__txn_id_t svn_fs_x__id_txn_id(const svn_fs_id_t *id);
 
-/* Get the "rev,item" portion of ID. */
-const svn_fs_x__id_part_t *svn_fs_x__id_rev_item(const svn_fs_id_t *id);
+/* Get the "noderev id" portion of ID. */
+const svn_fs_x__id_part_t *svn_fs_x__id_noderev_id(const svn_fs_id_t *id);
 
 /* Get the "rev" portion of ID, or SVN_INVALID_REVNUM if it is a
    transaction ID. */
@@ -154,12 +149,12 @@ svn_fs_id_t *svn_fs_x__id_txn_create(con
                                      svn_fs_x__txn_id_t txn_id,
                                      apr_pool_t *pool);
 
-/* Create a permanent ID based on NODE_ID, COPY_ID and REV_ITEM,
+/* Create a permanent ID based on NODE_ID, COPY_ID and NODEREV_ID,
    allocated in POOL. */
-svn_fs_id_t *svn_fs_x__id_rev_create(const svn_fs_x__id_part_t *node_id,
-                                     const svn_fs_x__id_part_t *copy_id,
-                                     const svn_fs_x__id_part_t *rev_item,
-                                     apr_pool_t *pool);
+svn_fs_id_t *svn_fs_x__id_create(const svn_fs_x__id_part_t *node_id,
+                                 const svn_fs_x__id_part_t *copy_id,
+                                 const svn_fs_x__id_part_t *noderev_id,
+                                 apr_pool_t *pool);
 
 /* Return a copy of ID, allocated from POOL. */
 svn_fs_id_t *svn_fs_x__id_copy(const svn_fs_id_t *id,

Modified: subversion/trunk/subversion/libsvn_fs_x/noderevs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/noderevs.c?rev=1568794&r1=1568793&r2=1568794&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/noderevs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/noderevs.c Sun Feb 16 17:52:14 2014
@@ -56,7 +56,7 @@ typedef struct binary_id_t
 {
   svn_fs_x__id_part_t node_id;
   svn_fs_x__id_part_t copy_id;
-  svn_fs_x__id_part_t rev_id;
+  svn_fs_x__id_part_t noderev_id;
 } binary_id_t;
 
 /* Our internal representation of an representation.
@@ -216,7 +216,7 @@ store_id(apr_array_header_t *ids,
   
   bin_id.node_id = *svn_fs_x__id_node_id(id);
   bin_id.copy_id = *svn_fs_x__id_copy_id(id);
-  bin_id.rev_id = *svn_fs_x__id_rev_item(id);
+  bin_id.noderev_id = *svn_fs_x__id_noderev_id(id);
 
   idx = (int)(apr_uintptr_t)apr_hash_get(dict, &bin_id, sizeof(bin_id));
   if (idx == 0)
@@ -369,10 +369,10 @@ get_id(const svn_fs_id_t **id,
 
   /* create a svn_fs_id_t from stored info */
   binary_id = &APR_ARRAY_IDX(ids, idx - 1, binary_id_t);
-  *id = svn_fs_x__id_rev_create(&binary_id->node_id,
-                                &binary_id->copy_id,
-                                &binary_id->rev_id,
-                                pool);
+  *id = svn_fs_x__id_create(&binary_id->node_id,
+                            &binary_id->copy_id,
+                            &binary_id->noderev_id,
+                            pool);
 
   return SVN_NO_ERROR;
 }
@@ -600,8 +600,8 @@ svn_fs_x__write_noderevs_container(svn_s
       svn_packed__add_uint(ids_stream, id->node_id.number);
       svn_packed__add_int(ids_stream, id->copy_id.change_set);
       svn_packed__add_uint(ids_stream, id->copy_id.number);
-      svn_packed__add_int(ids_stream, id->rev_id.change_set);
-      svn_packed__add_uint(ids_stream, id->rev_id.number);
+      svn_packed__add_int(ids_stream, id->noderev_id.change_set);
+      svn_packed__add_uint(ids_stream, id->noderev_id.number);
     }
 
   /* serialize rep arrays */
@@ -749,8 +749,8 @@ svn_fs_x__read_noderevs_container(svn_fs
       id.node_id.number = svn_packed__get_uint(ids_stream);
       id.copy_id.change_set = (svn_revnum_t)svn_packed__get_int(ids_stream);
       id.copy_id.number = svn_packed__get_uint(ids_stream);
-      id.rev_id.change_set = (svn_revnum_t)svn_packed__get_int(ids_stream);
-      id.rev_id.number = svn_packed__get_uint(ids_stream);
+      id.noderev_id.change_set = (svn_revnum_t)svn_packed__get_int(ids_stream);
+      id.noderev_id.number = svn_packed__get_uint(ids_stream);
 
       APR_ARRAY_PUSH(noderevs->ids, binary_id_t) = id;
     }

Modified: subversion/trunk/subversion/libsvn_fs_x/pack.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/pack.c?rev=1568794&r1=1568793&r2=1568794&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/pack.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/pack.c Sun Feb 16 17:52:14 2014
@@ -680,7 +680,7 @@ copy_node_to_temp(pack_context_t *contex
                                                noderev->created_path);
   path_order->node_id = *svn_fs_x__id_node_id(noderev->id);
   path_order->revision = svn_fs_x__id_rev(noderev->id);
-  path_order->noderev_id = *svn_fs_x__id_rev_item(noderev->id);
+  path_order->noderev_id = *svn_fs_x__id_noderev_id(noderev->id);
   APR_ARRAY_PUSH(context->path_order, path_order_t *) = path_order;
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/transaction.c?rev=1568794&r1=1568793&r2=1568794&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/transaction.c Sun Feb 16 17:52:14 2014
@@ -2607,7 +2607,7 @@ write_final_rev(const svn_fs_id_t **new_
                                 pool));
 
   noderev_id.change_set = change_set;
-  new_id = svn_fs_x__id_rev_create(&node_id, &copy_id, &noderev_id, pool);
+  new_id = svn_fs_x__id_create(&node_id, &copy_id, &noderev_id, pool);
 
   noderev->id = new_id;
 

Modified: subversion/trunk/subversion/libsvn_fs_x/tree.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/tree.c?rev=1568794&r1=1568793&r2=1568794&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/tree.c Sun Feb 16 17:52:14 2014
@@ -1319,7 +1319,7 @@ x_node_relation(svn_fs_node_relation_t *
 {
   dag_node_t *node;
   const svn_fs_id_t *id;
-  svn_fs_x__id_part_t rev_item_a, rev_item_b, node_id_a, node_id_b;
+  svn_fs_x__id_part_t noderev_id_a, noderev_id_b, node_id_a, node_id_b;
 
   /* Root paths are a common special case. */
   svn_boolean_t a_is_root_dir
@@ -1357,15 +1357,15 @@ x_node_relation(svn_fs_node_relation_t *
    * Now, we can simply test for the ID values themselves. */
   SVN_ERR(get_dag(&node, root_a, path_a, FALSE, pool));
   id = svn_fs_x__dag_get_id(node);
-  rev_item_a = *svn_fs_x__id_rev_item(id);
+  noderev_id_a = *svn_fs_x__id_noderev_id(id);
   node_id_a = *svn_fs_x__id_node_id(id);
 
   SVN_ERR(get_dag(&node, root_b, path_b, FALSE, pool));
   id = svn_fs_x__dag_get_id(node);
-  rev_item_b = *svn_fs_x__id_rev_item(id);
+  noderev_id_b = *svn_fs_x__id_noderev_id(id);
   node_id_b = *svn_fs_x__id_node_id(id);
 
-  if (svn_fs_x__id_part_eq(&rev_item_a, &rev_item_b))
+  if (svn_fs_x__id_part_eq(&noderev_id_a, &noderev_id_b))
     *relation = svn_fs_node_same;
   else if (svn_fs_x__id_part_eq(&node_id_a, &node_id_b))
     *relation = svn_fs_node_common_anchestor;



Mime
View raw message