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/03/08 22:27:05 UTC

svn commit: r1454582 - in /subversion/branches/fsfs-format7/subversion/libsvn_fs_fs: cached_data.c dag.c id.c id.h low_level.c transaction.c

Author: stefan2
Date: Fri Mar  8 21:27:04 2013
New Revision: 1454582

URL: http://svn.apache.org/r1454582
Log:
On the fsfs-format7 branch:  Add a function that tests whether a given ID
is an ID with a transaction.  That eliminates the need for users to get
and check the TXN_ID member themselves, i.e. this reduces the dependencies
on the internal representation of said TXN_ID.

This is part of the "numerical IDs" patch series.

* subversion/libsvn_fs_fs/id.h
  (svn_fs_fs__id_is_txn): declare new private API

* subversion/libsvn_fs_fs/id.c
  (svn_fs_fs__id_is_txn): implement

* subversion/libsvn_fs_fs/cached_data.c
  (get_node_revision_body,
   locate_dir_cache): use the new API

* subversion/libsvn_fs_fs/dag.c
  (svn_fs_fs__dag_check_mutable): ditto

* subversion/libsvn_fs_fs/low_level.c
  (svn_fs_fs__write_changes): same here

* subversion/libsvn_fs_fs/transaction.c
  (create_new_txn_noderev_from_rev,
   write_final_rev): and here

Modified:
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/dag.c
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/id.c
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/id.h
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/low_level.c
    subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/transaction.c

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c?rev=1454582&r1=1454581&r2=1454582&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c Fri Mar  8 21:27:04 2013
@@ -293,9 +293,8 @@ get_node_revision_body(node_revision_t *
   svn_error_t *err;
   svn_boolean_t is_cached = FALSE;
   fs_fs_data_t *ffd = fs->fsap_data;
-  const char *txn_id = svn_fs_fs__id_txn_id(id);
 
-  if (txn_id)
+  if (svn_fs_fs__id_is_txn(id))
     {
       /* This is a transaction node-rev.  Its storage logic is very
          different from that of rev / pack files. */
@@ -1954,7 +1953,7 @@ locate_dir_cache(svn_fs_t *fs,
                  apr_pool_t *pool)
 {
   fs_fs_data_t *ffd = fs->fsap_data;
-  if (svn_fs_fs__id_txn_id(noderev->id))
+  if (svn_fs_fs__id_is_txn(noderev->id))
     {
       /* data in txns requires the expensive fs_id-based addressing mode */
       *key = svn_fs_fs__id_unparse(noderev->id, pool)->data;

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/dag.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/dag.c?rev=1454582&r1=1454581&r2=1454582&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/dag.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/dag.c Fri Mar  8 21:27:04 2013
@@ -174,7 +174,7 @@ get_node_revision(node_revision_t **node
 
 svn_boolean_t svn_fs_fs__dag_check_mutable(const dag_node_t *node)
 {
-  return (svn_fs_fs__id_txn_id(svn_fs_fs__dag_get_id(node)) != NULL);
+  return svn_fs_fs__id_is_txn(svn_fs_fs__dag_get_id(node));
 }
 
 

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/id.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/id.c?rev=1454582&r1=1454581&r2=1454582&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/id.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/id.c Fri Mar  8 21:27:04 2013
@@ -180,6 +180,13 @@ svn_fs_fs__id_item(const svn_fs_id_t *fs
   return id->rev_item.number;
 }
 
+svn_boolean_t
+svn_fs_fs__id_is_txn(const svn_fs_id_t *fs_id)
+{
+  fs_fs__id_t *id = (fs_fs__id_t *)fs_id;
+
+  return id->txn_id != NULL;
+}
 
 svn_string_t *
 svn_fs_fs__id_unparse(const svn_fs_id_t *fs_id,

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/id.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/id.h?rev=1454582&r1=1454581&r2=1454582&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/id.h (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/id.h Fri Mar  8 21:27:04 2013
@@ -77,6 +77,9 @@ svn_revnum_t svn_fs_fs__id_rev(const svn
    ID. */
 apr_uint64_t svn_fs_fs__id_item(const svn_fs_id_t *id);
 
+/* Return TRUE, if this is a transaction ID. */
+svn_boolean_t svn_fs_fs__id_is_txn(const svn_fs_id_t *id);
+
 /* Convert ID into string form, allocated in POOL. */
 svn_string_t *svn_fs_fs__id_unparse(const svn_fs_id_t *id,
                                     apr_pool_t *pool);

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/low_level.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/low_level.c?rev=1454582&r1=1454581&r2=1454582&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/low_level.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/low_level.c Fri Mar  8 21:27:04 2013
@@ -1004,7 +1004,7 @@ svn_fs_fs__write_changes(svn_stream_t *s
          leave the change entry pointing to the non-existent temporary
          node, since it will never be used. */
       if ((change->change_kind != svn_fs_path_change_delete) &&
-          (! svn_fs_fs__id_txn_id(id)))
+          (! svn_fs_fs__id_is_txn(id)))
         {
           SVN_ERR(svn_fs_fs__get_node_revision(&noderev, fs, id, iterpool));
 

Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/transaction.c?rev=1454582&r1=1454581&r2=1454582&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/transaction.c Fri Mar  8 21:27:04 2013
@@ -964,7 +964,7 @@ create_new_txn_noderev_from_rev(svn_fs_t
 
   SVN_ERR(svn_fs_fs__get_node_revision(&noderev, fs, src, pool));
 
-  if (svn_fs_fs__id_txn_id(noderev->id))
+  if (svn_fs_fs__id_is_txn(noderev->id))
     return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
                             _("Copying from transactions not allowed"));
 
@@ -2652,7 +2652,7 @@ write_final_rev(const svn_fs_id_t **new_
   *new_id_p = NULL;
 
   /* Check to see if this is a transaction node. */
-  if (! txn_id)
+  if (! svn_fs_fs__id_is_txn(id))
     return SVN_NO_ERROR;
 
   SVN_ERR(svn_fs_fs__get_node_revision(&noderev, fs, id, pool));