Author: stefan2
Date: Wed Feb  4 11:05:51 2015
New Revision: 1657117

URL: http://svn.apache.org/r1657117
Log:
Using the new ID code in FSX, we can determine the "is-fresh-txn-root"
state dynamically instead of storing it in the repository.

This commit only introduces and uses the new function but keeps the
old data structure plus its readers and writes as is.

* subversion/libsvn_fs_x/transaction.h
  (svn_fs_x__is_fresh_txn_root): Declare the new private API.

* subversion/libsvn_fs_x/transaction.c
  (svn_fs_x__is_fresh_txn_root): Implement it.

* subversion/libsvn_fs_x/dag.c
  (svn_fs_x__dag_get_node): Call the new function.

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

Modified: subversion/trunk/subversion/libsvn_fs_x/dag.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/dag.c?rev=1657117&r1=1657116&r2=1657117&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/dag.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/dag.c Wed Feb  4 11:05:51 2015
@@ -267,7 +267,7 @@ svn_fs_x__dag_get_node(dag_node_t **node
   /* Support our quirky svn_fs_node_created_rev API.
      Untouched txn roots report the base rev as theirs. */
   new_node->revision
-    = (  noderev->is_fresh_txn_root
+    = (  svn_fs_x__is_fresh_txn_root(noderev)
        ? svn_fs_x__get_revnum(noderev->predecessor_id.change_set)
        : svn_fs_x__get_revnum(id->change_set));
 

Modified: subversion/trunk/subversion/libsvn_fs_x/transaction.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/transaction.c?rev=1657117&r1=1657116&r2=1657117&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/transaction.c Wed Feb  4 11:05:51 
2015
@@ -758,6 +758,31 @@ purge_shared_txn(svn_fs_t *fs,
 }
 
 
+svn_boolean_t
+svn_fs_x__is_fresh_txn_root(svn_fs_x__noderev_t *noderev)
+{
+  /* Is it a root node? */
+  if (noderev->noderev_id.number != SVN_FS_X__ITEM_INDEX_ROOT_NODE)
+    return FALSE;
+
+  /* ... in a transaction? */
+  if (!svn_fs_x__is_txn(noderev->noderev_id.change_set))
+    return FALSE;
+
+  /* ... with no prop change in that txn?
+     (Once we set a property, the prop rep will never become NULL again.) */
+  if (noderev->prop_rep && svn_fs_x__is_txn(noderev->prop_rep->id.change_set))
+    return FALSE;
+
+  /* ... and no sub-tree change?
+     (Once we set a text, the data rep will never become NULL again.) */
+  if (noderev->data_rep && svn_fs_x__is_txn(noderev->data_rep->id.change_set))
+    return FALSE;
+
+  /* Root node of a txn with no changes. */
+  return TRUE;
+}
+
 svn_error_t *
 svn_fs_x__put_node_revision(svn_fs_t *fs,
                             svn_fs_x__noderev_t *noderev,

Modified: subversion/trunk/subversion/libsvn_fs_x/transaction.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/transaction.h?rev=1657117&r1=1657116&r2=1657117&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/transaction.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/transaction.h Wed Feb  4 11:05:51 
2015
@@ -73,6 +73,11 @@ svn_fs_x__with_all_locks(svn_fs_t *fs,
                          void *baton,
                          apr_pool_t *scratch_pool);
 
+/* Return TRUE, iff NODEREV is the root node of a transaction that has not
+   seen any modifications, yet. */
+svn_boolean_t
+svn_fs_x__is_fresh_txn_root(svn_fs_x__noderev_t *noderev);
+
 /* Store NODEREV as the node-revision in the transaction defined by NODEREV's
    ID within FS, after setting its is_fresh_txn_root to FRESH_TXN_ROOT.  Do
    any necessary temporary allocation in SCRATCH_POOL. */


Reply via email to