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 2014/12/27 20:29:23 UTC
svn commit: r1648094 - in
/subversion/branches/fsx-id/subversion/libsvn_fs_x: changes.c fs.h
low_level.c temp_serializer.c transaction.c tree.c
Author: stefan2
Date: Sat Dec 27 19:29:22 2014
New Revision: 1648094
URL: http://svn.apache.org/r1648094
Log:
On the fsx-id branch:
Replace the svn_fs_id_t in change_t with our FSX internal ID type.
Defer the ID construction to the interface function.
All FS API objects have now been removed from FSX internal structures.
* subversion/libsvn_fs_x/fs.h
(change_t): Switch ID type.
* subversion/libsvn_fs_x/temp_serializer.c
(serialize_change,
deserialize_change): One less sub-structure to (de-)serialize.
* subversion/libsvn_fs_x/low_level.c
(read_change,
write_change_entry): Use the appropriate parser / writer functions.
* subversion/libsvn_fs_x/changes.c
(binary_change_t): The node-ID is no longer needed.
(append_change,
svn_fs_x__changes_get_list): No ID conversion necessary anymore.
(svn_fs_x__write_changes_container,
svn_fs_x__read_changes_container): One sub-struct less to store / load.
(svn_fs_x__changes_get_list_func): No ID conversion necessary anymore.
* subversion/libsvn_fs_x/transaction.c
(path_change_dup): ID doesn't require a manual copy anymore.
(fold_change): Update ID checks.
(svn_fs_x__add_change): Don't convert the ID here.
* subversion/libsvn_fs_x/tree.c
(construct_fs_path_change): Implement the ID conversion here. The node-ID
lookup here is only temporary and will soon
become unnecessary.
(x_paths_changed): Update caller.
Modified:
subversion/branches/fsx-id/subversion/libsvn_fs_x/changes.c
subversion/branches/fsx-id/subversion/libsvn_fs_x/fs.h
subversion/branches/fsx-id/subversion/libsvn_fs_x/low_level.c
subversion/branches/fsx-id/subversion/libsvn_fs_x/temp_serializer.c
subversion/branches/fsx-id/subversion/libsvn_fs_x/transaction.c
subversion/branches/fsx-id/subversion/libsvn_fs_x/tree.c
Modified: subversion/branches/fsx-id/subversion/libsvn_fs_x/changes.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/libsvn_fs_x/changes.c?rev=1648094&r1=1648093&r2=1648094&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/libsvn_fs_x/changes.c (original)
+++ subversion/branches/fsx-id/subversion/libsvn_fs_x/changes.c Sat Dec 27 19:29:22 2014
@@ -79,7 +79,6 @@ typedef struct binary_change_t
/* Relevant parts of the node revision ID of the change.
* Empty, if REV_ID is not "used". */
- svn_fs_x__id_part_t node_id;
svn_fs_x__id_part_t noderev_id;
} binary_change_t;
@@ -145,19 +144,10 @@ append_change(svn_fs_x__changes_t *chang
SVN_ERR_ASSERT(change->path.data);
/* Relevant parts of the revision ID of the change. */
- if (change->node_rev_id)
- {
- binary_change.node_id = *svn_fs_x__id_node_id(change->node_rev_id);
- binary_change.noderev_id = *svn_fs_x__id_noderev_id(change->node_rev_id);
- }
- else
- {
- binary_change.noderev_id.number = 0;
- binary_change.noderev_id.change_set = SVN_FS_X__INVALID_CHANGE_SET;
- }
+ binary_change.noderev_id = change->noderev_id;
/* define the kind of change and what specific information is present */
- is_txn_id = change->node_rev_id && svn_fs_x__id_is_txn(change->node_rev_id);
+ is_txn_id = svn_fs_x__is_txn(binary_change.noderev_id.change_set);
binary_change.flags = (change->text_mod ? CHANGE_TEXT_MOD : 0)
| (change->prop_mod ? CHANGE_PROP_MOD : 0)
| (is_txn_id ? CHANGE_TXN_NODE : 0)
@@ -269,9 +259,7 @@ svn_fs_x__changes_get_list(apr_array_hea
pool);
if (binary_change->noderev_id.change_set != SVN_FS_X__INVALID_CHANGE_SET)
- change->node_rev_id = svn_fs_x__id_create(&binary_change->node_id,
- &binary_change->noderev_id,
- pool);
+ change->noderev_id = binary_change->noderev_id;
change->change_kind = (svn_fs_path_change_kind_t)
((binary_change->flags & CHANGE_KIND_MASK) >> CHANGE_KIND_SHIFT);
@@ -324,9 +312,7 @@ svn_fs_x__write_changes_container(svn_st
svn_packed__create_int_substream(changes_stream, TRUE, FALSE);
svn_packed__create_int_substream(changes_stream, TRUE, TRUE);
svn_packed__create_int_substream(changes_stream, TRUE, FALSE);
- svn_packed__create_int_substream(changes_stream, TRUE, TRUE);
- svn_packed__create_int_substream(changes_stream, TRUE, FALSE);
-
+
/* serialize offsets array */
for (i = 0; i < changes->offsets->nelts; ++i)
svn_packed__add_uint(offsets_stream,
@@ -344,8 +330,6 @@ svn_fs_x__write_changes_container(svn_st
svn_packed__add_int(changes_stream, change->copyfrom_rev);
svn_packed__add_uint(changes_stream, change->copyfrom_path);
- svn_packed__add_int(changes_stream, change->node_id.change_set);
- svn_packed__add_uint(changes_stream, change->node_id.number);
svn_packed__add_int(changes_stream, change->noderev_id.change_set);
svn_packed__add_uint(changes_stream, change->noderev_id.number);
}
@@ -402,8 +386,6 @@ 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_packed__get_int(changes_stream);
- change.node_id.number = svn_packed__get_uint(changes_stream);
change.noderev_id.change_set = svn_packed__get_int(changes_stream);
change.noderev_id.number = svn_packed__get_uint(changes_stream);
@@ -525,10 +507,7 @@ svn_fs_x__changes_get_list_func(void **o
= svn_fs_x__string_table_get_func(paths, binary_change->path,
&change->path.len, pool);
- if (binary_change->noderev_id.change_set != SVN_FS_X__INVALID_CHANGE_SET)
- change->node_rev_id = svn_fs_x__id_create(&binary_change->node_id,
- &binary_change->noderev_id,
- pool);
+ change->noderev_id = binary_change->noderev_id;
change->change_kind = (svn_fs_path_change_kind_t)
((binary_change->flags & CHANGE_KIND_MASK) >> CHANGE_KIND_SHIFT);
Modified: subversion/branches/fsx-id/subversion/libsvn_fs_x/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/libsvn_fs_x/fs.h?rev=1648094&r1=1648093&r2=1648094&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/libsvn_fs_x/fs.h (original)
+++ subversion/branches/fsx-id/subversion/libsvn_fs_x/fs.h Sat Dec 27 19:29:22 2014
@@ -550,7 +550,7 @@ typedef struct change_t
svn_string_t path;
/* node revision id of changed path */
- const svn_fs_id_t *node_rev_id;
+ svn_fs_x__noderev_id_t noderev_id;
/* See svn_fs_path_change2_t for a description for the remaining elements.
*/
Modified: subversion/branches/fsx-id/subversion/libsvn_fs_x/low_level.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/libsvn_fs_x/low_level.c?rev=1648094&r1=1648093&r2=1648094&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/libsvn_fs_x/low_level.c (original)
+++ subversion/branches/fsx-id/subversion/libsvn_fs_x/low_level.c Sat Dec 27 19:29:22 2014
@@ -805,10 +805,7 @@ read_change(change_t **change_p,
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
_("Invalid changes line in rev-file"));
- SVN_ERR(svn_fs_x__id_parse(&change->node_rev_id, str, result_pool));
- if (change->node_rev_id == NULL)
- return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
- _("Invalid changes line in rev-file"));
+ SVN_ERR(svn_fs_x__id_part_parse(&change->noderev_id, str));
/* Get the change type. */
str = svn_cstring_tokenize(" ", &last_str);
@@ -1050,10 +1047,7 @@ write_change_entry(svn_stream_t *stream,
change->change_kind);
}
- if (change->node_rev_id)
- idstr = svn_fs_x__id_unparse(change->node_rev_id, scratch_pool)->data;
- else
- idstr = ACTION_RESET;
+ idstr = svn_fs_x__id_part_unparse(&change->noderev_id, scratch_pool)->data;
SVN_ERR_ASSERT(change->node_kind == svn_node_dir
|| change->node_kind == svn_node_file);
Modified: subversion/branches/fsx-id/subversion/libsvn_fs_x/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/libsvn_fs_x/temp_serializer.c?rev=1648094&r1=1648093&r2=1648094&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/libsvn_fs_x/temp_serializer.c (original)
+++ subversion/branches/fsx-id/subversion/libsvn_fs_x/temp_serializer.c Sat Dec 27 19:29:22 2014
@@ -1075,8 +1075,6 @@ serialize_change(svn_temp_serializer__co
sizeof(*change));
/* serialize sub-structures */
- svn_fs_x__id_serialize(context, &change->node_rev_id);
-
svn_temp_serializer__add_string(context, &change->path.data);
svn_temp_serializer__add_string(context, &change->copyfrom_path);
@@ -1102,10 +1100,6 @@ deserialize_change(void *buffer,
return;
/* fix-up of sub-structures */
- svn_fs_x__id_deserialize(change,
- (svn_fs_id_t **)&change->node_rev_id,
- pool);
-
svn_temp_deserializer__resolve(change, (void **)&change->path.data);
svn_temp_deserializer__resolve(change, (void **)&change->copyfrom_path);
}
Modified: subversion/branches/fsx-id/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/libsvn_fs_x/transaction.c?rev=1648094&r1=1648093&r2=1648094&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/branches/fsx-id/subversion/libsvn_fs_x/transaction.c Sat Dec 27 19:29:22 2014
@@ -867,7 +867,6 @@ path_change_dup(const change_t *source,
change_t *result = apr_pmemdup(result_pool, source, sizeof(*source));
result->path.data = apr_pstrmemdup(result_pool, source->path.data,
source->path.len);
- result->node_rev_id = svn_fs_x__id_copy(source->node_rev_id, result_pool);
if (source->copyfrom_path)
result->copyfrom_path = apr_pstrdup(result_pool, source->copyfrom_path);
@@ -893,9 +892,9 @@ fold_change(apr_hash_t *changed_paths,
/* This path already exists in the hash, so we have to merge
this change into the already existing one. */
- /* Sanity check: only allow NULL node revision ID in the
+ /* Sanity check: only allow unused node revision IDs in the
`reset' case. */
- if ((! change->node_rev_id)
+ if ((! svn_fs_x__id_part_used(&change->noderev_id))
&& (change->change_kind != svn_fs_path_change_reset))
return svn_error_create
(SVN_ERR_FS_CORRUPT, NULL,
@@ -904,8 +903,9 @@ fold_change(apr_hash_t *changed_paths,
/* Sanity check: we should be talking about the same node
revision ID as our last change except where the last change
was a deletion. */
- if (change->node_rev_id
- && (! svn_fs_x__id_eq(old_change->node_rev_id, change->node_rev_id))
+ if (svn_fs_x__id_part_used(&change->noderev_id)
+ && (! svn_fs_x__id_part_eq(&old_change->noderev_id,
+ &change->noderev_id))
&& (old_change->change_kind != svn_fs_path_change_delete))
return svn_error_create
(SVN_ERR_FS_CORRUPT, NULL,
@@ -1768,22 +1768,6 @@ svn_fs_x__add_change(svn_fs_t *fs,
change_t change;
apr_hash_t *changes = apr_hash_make(pool);
- const svn_fs_id_t *fs_id;
- if ( svn_fs_x__is_txn(id->change_set)
- && change_kind == svn_fs_path_change_delete)
- {
- /* There is no valid ID. Provide a dummy. */
- svn_fs_x__id_part_t dummy;
- svn_fs_x__id_part_reset(&dummy);
- fs_id = svn_fs_x__id_create(&dummy, id, pool);
- }
- else
- {
- node_revision_t *noderev;
- SVN_ERR(svn_fs_x__get_node_revision(&noderev, fs, id, pool, pool));
- fs_id = svn_fs_x__id_create(&noderev->node_id, id, pool);
- }
-
/* Not using APR_BUFFERED to append change in one atomic write operation. */
SVN_ERR(svn_io_file_open(&file,
svn_fs_x__path_txn_changes(fs, txn_id, pool),
@@ -1792,7 +1776,7 @@ svn_fs_x__add_change(svn_fs_t *fs,
change.path.data = path;
change.path.len = strlen(path);
- change.node_rev_id = fs_id;
+ change.noderev_id = *id;
change.change_kind = change_kind;
change.text_mod = text_mod;
change.prop_mod = prop_mod;
Modified: subversion/branches/fsx-id/subversion/libsvn_fs_x/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/libsvn_fs_x/tree.c?rev=1648094&r1=1648093&r2=1648094&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/branches/fsx-id/subversion/libsvn_fs_x/tree.c Sat Dec 27 19:29:22 2014
@@ -3291,16 +3291,32 @@ x_get_file_delta_stream(svn_txdelta_stre
/* Finding Changes */
/* Copy CHANGE into a FS API object allocated in RESULT_POOL. */
-static svn_fs_path_change2_t *
-construct_fs_path_change(change_t *change,
- apr_pool_t *result_pool)
+static svn_error_t *
+construct_fs_path_change(svn_fs_path_change2_t **result_p,
+ svn_fs_t *fs,
+ change_t *change,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
- const svn_fs_id_t *id
- = change->node_rev_id;
- svn_fs_path_change2_t *result
- = svn_fs__path_change_create_internal(id, change->change_kind,
- result_pool);
+ dag_node_t *node;
+ const svn_fs_id_t *id;
+ svn_fs_path_change2_t *result;
+
+ if (svn_fs_x__is_txn(change->noderev_id.change_set))
+ {
+ svn_fs_x__id_part_t dummy;
+ svn_fs_x__id_part_reset(&dummy);
+ id = svn_fs_x__id_create(&dummy, &change->noderev_id, result_pool);
+ }
+ else
+ {
+ SVN_ERR(svn_fs_x__dag_get_node(&node, fs, &change->noderev_id,
+ scratch_pool));
+ SVN_ERR(svn_fs_x__dag_get_fs_id(&id, node, result_pool));
+ }
+ result = svn_fs__path_change_create_internal(id, change->change_kind,
+ result_pool);
result->text_mod = change->text_mod;
result->prop_mod = change->prop_mod;
result->node_kind = change->node_kind;
@@ -3311,7 +3327,9 @@ construct_fs_path_change(change_t *chang
result->mergeinfo_mod = change->mergeinfo_mod;
- return result;
+ *result_p = result;
+
+ return SVN_NO_ERROR;
}
/* Set *CHANGED_PATHS_P to a newly allocated hash containing
@@ -3324,6 +3342,7 @@ x_paths_changed(apr_hash_t **changed_pat
apr_pool_t *pool)
{
apr_hash_t *changed_paths;
+ svn_fs_path_change2_t *path_change;
if (root->is_txn_root)
{
@@ -3335,9 +3354,11 @@ x_paths_changed(apr_hash_t **changed_pat
hi = apr_hash_next(hi))
{
change_t *change = apr_hash_this_val(hi);
+ SVN_ERR(construct_fs_path_change(&path_change, root->fs, change,
+ pool, pool));
apr_hash_set(changed_paths,
apr_hash_this_key(hi), apr_hash_this_key_len(hi),
- construct_fs_path_change(change, pool));
+ path_change);
}
}
else
@@ -3351,8 +3372,10 @@ x_paths_changed(apr_hash_t **changed_pat
for (i = 0; i < changes->nelts; ++i)
{
change_t *change = APR_ARRAY_IDX(changes, i, change_t *);
+ SVN_ERR(construct_fs_path_change(&path_change, root->fs, change,
+ pool, pool));
apr_hash_set(changed_paths, change->path.data, change->path.len,
- construct_fs_path_change(change, pool));
+ path_change);
}
}