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 2015/05/20 10:04:06 UTC
svn commit: r1680479 - /subversion/trunk/subversion/tests/svn_test_fs.c
Author: stefan2
Date: Wed May 20 08:04:05 2015
New Revision: 1680479
URL: http://svn.apache.org/r1680479
Log:
Revert part of r1680476 that got committed accidentally.
* subversion/tests/svn_test_fs.c: revert changes.
Modified:
subversion/trunk/subversion/tests/svn_test_fs.c
Modified: subversion/trunk/subversion/tests/svn_test_fs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test_fs.c?rev=1680479&r1=1680478&r2=1680479&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test_fs.c (original)
+++ subversion/trunk/subversion/tests/svn_test_fs.c Wed May 20 08:04:05 2015
@@ -399,30 +399,27 @@ static svn_error_t *
get_dir_entries(apr_hash_t *tree_entries,
svn_fs_root_t *root,
const char *path,
- apr_pool_t *scratch_pool)
+ apr_pool_t *pool)
{
apr_hash_t *entries;
apr_hash_index_t *hi;
- apr_pool_t *iterpool = svn_pool_create(scratch_pool);
- apr_pool_t *result_pool = apr_hash_pool_get(tree_entries);
- SVN_ERR(svn_fs_dir_entries(&entries, root, path, scratch_pool));
+ SVN_ERR(svn_fs_dir_entries(&entries, root, path, pool));
/* Copy this list to the master list with the path prepended to the
names */
- for (hi = apr_hash_first(scratch_pool, entries); hi; hi = apr_hash_next(hi))
+ for (hi = apr_hash_first(pool, entries); hi; hi = apr_hash_next(hi))
{
void *val;
svn_fs_dirent_t *dirent;
const char *full_path;
- svn_pool_clear(iterpool);
apr_hash_this(hi, NULL, NULL, &val);
dirent = val;
/* Calculate the full path of this entry (by appending the name
to the path thus far) */
- full_path = svn_path_join(path, dirent->name, result_pool);
+ full_path = svn_path_join(path, dirent->name, pool);
/* Now, copy this dirent to the master hash, but this time, use
the full path for the key */
@@ -430,7 +427,7 @@ get_dir_entries(apr_hash_t *tree_entries
/* If this entry is a directory, recurse into the tree. */
if (dirent->kind == svn_node_dir)
- SVN_ERR(get_dir_entries(tree_entries, root, full_path, iterpool));
+ SVN_ERR(get_dir_entries(tree_entries, root, full_path, pool));
}
return SVN_NO_ERROR;
@@ -503,7 +500,6 @@ svn_test__validate_tree(svn_fs_root_t *r
{
apr_hash_t *tree_entries, *expected_entries;
apr_pool_t *subpool = svn_pool_create(pool);
- apr_pool_t *iterpool = svn_pool_create(pool);
svn_stringbuf_t *extra_entries = NULL;
svn_stringbuf_t *missing_entries = NULL;
svn_stringbuf_t *corrupt_entries = NULL;
@@ -513,13 +509,6 @@ svn_test__validate_tree(svn_fs_root_t *r
/* There should be no entry with this name. */
const char *na_name = "es-vee-en";
- /* Create our master hash for storing the entries */
- tree_entries = apr_hash_make(subpool);
-
- /* Recursively get the whole tree */
- SVN_ERR(get_dir_entries(tree_entries, root, "", iterpool));
- svn_pool_clear(iterpool);
-
/* Create a hash for storing our expected entries */
expected_entries = apr_hash_make(subpool);
@@ -528,6 +517,12 @@ svn_test__validate_tree(svn_fs_root_t *r
apr_hash_set(expected_entries, entries[i].path,
APR_HASH_KEY_STRING, &(entries[i]));
+ /* Create our master hash for storing the entries */
+ tree_entries = apr_hash_make(pool);
+
+ /* Begin the recursive directory entry dig */
+ SVN_ERR(get_dir_entries(tree_entries, root, "", subpool));
+
/* For each entry in our EXPECTED_ENTRIES hash, try to find that
entry in the TREE_ENTRIES hash given us by the FS. If we find
that object, remove it from the TREE_ENTRIES. If we don't find
@@ -541,7 +536,6 @@ svn_test__validate_tree(svn_fs_root_t *r
void *val;
svn_test__tree_entry_t *entry;
- svn_pool_clear(iterpool);
apr_hash_this(hi, &key, &keylen, &val);
entry = val;
@@ -552,7 +546,7 @@ svn_test__validate_tree(svn_fs_root_t *r
svn_error_t *err;
if ((err = validate_tree_entry(root, entry->path,
- entry->contents, iterpool)))
+ entry->contents, subpool)))
{
/* If we don't have a corrupt entries string, make one. */
if (! corrupt_entries)
@@ -633,7 +627,6 @@ svn_test__validate_tree(svn_fs_root_t *r
extra_entries ? extra_entries->data : "");
}
- svn_pool_destroy(iterpool);
svn_pool_destroy(subpool);
return SVN_NO_ERROR;
}
@@ -682,7 +675,6 @@ svn_test__txn_script_exec(svn_fs_root_t
apr_pool_t *pool)
{
int i;
- apr_pool_t *iterpool = svn_pool_create(pool);
/* Run through the list of edits, making the appropriate edit on
that entry in the TXN_ROOT. */
@@ -693,19 +685,18 @@ svn_test__txn_script_exec(svn_fs_root_t
int cmd = script[i].cmd;
svn_boolean_t is_dir = (param1 == 0);
- svn_pool_clear(iterpool);
switch (cmd)
{
case 'a':
if (is_dir)
{
- SVN_ERR(svn_fs_make_dir(txn_root, path, iterpool));
+ SVN_ERR(svn_fs_make_dir(txn_root, path, pool));
}
else
{
- SVN_ERR(svn_fs_make_file(txn_root, path, iterpool));
+ SVN_ERR(svn_fs_make_file(txn_root, path, pool));
SVN_ERR(svn_test__set_file_contents(txn_root, path,
- param1, iterpool));
+ param1, pool));
}
break;
@@ -715,21 +706,21 @@ svn_test__txn_script_exec(svn_fs_root_t
svn_fs_root_t *rev_root;
svn_fs_t *fs = svn_fs_root_fs(txn_root);
- SVN_ERR(svn_fs_youngest_rev(&youngest, fs, iterpool));
- SVN_ERR(svn_fs_revision_root(&rev_root, fs, youngest, iterpool));
- SVN_ERR(svn_fs_copy(rev_root, path, txn_root, param1, iterpool));
+ SVN_ERR(svn_fs_youngest_rev(&youngest, fs, pool));
+ SVN_ERR(svn_fs_revision_root(&rev_root, fs, youngest, pool));
+ SVN_ERR(svn_fs_copy(rev_root, path, txn_root, param1, pool));
}
break;
case 'd':
- SVN_ERR(svn_fs_delete(txn_root, path, iterpool));
+ SVN_ERR(svn_fs_delete(txn_root, path, pool));
break;
case 'e':
if (! is_dir)
{
SVN_ERR(svn_test__set_file_contents(txn_root, path,
- param1, iterpool));
+ param1, pool));
}
break;
@@ -738,7 +729,6 @@ svn_test__txn_script_exec(svn_fs_root_t
}
}
- svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}
@@ -775,26 +765,21 @@ svn_test__check_greek_tree(svn_fs_root_t
svn_stringbuf_t *rstring;
svn_stringbuf_t *content;
const struct svn_test__tree_entry_t *node;
- apr_pool_t *iterpool = svn_pool_create(pool);
/* Loop through the list of files, checking for matching content. */
for (node = svn_test__greek_tree_nodes; node->path; node++)
{
if (node->contents)
{
- svn_pool_clear(iterpool);
-
- SVN_ERR(svn_fs_file_contents(&rstream, root, node->path, iterpool));
- SVN_ERR(svn_test__stream_to_string(&rstring, rstream, iterpool));
- content = svn_stringbuf_create(node->contents, iterpool);
+ SVN_ERR(svn_fs_file_contents(&rstream, root, node->path, pool));
+ SVN_ERR(svn_test__stream_to_string(&rstring, rstream, pool));
+ content = svn_stringbuf_create(node->contents, pool);
if (! svn_stringbuf_compare(rstring, content))
return svn_error_createf(SVN_ERR_FS_GENERAL, NULL,
"data read != data written in file '%s'.",
node->path);
}
}
-
- svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}
@@ -804,28 +789,22 @@ svn_test__create_greek_tree_at(svn_fs_ro
apr_pool_t *pool)
{
const struct svn_test__tree_entry_t *node;
- apr_pool_t *iterpool = svn_pool_create(pool);
for (node = svn_test__greek_tree_nodes; node->path; node++)
{
- const char *path;
- svn_pool_clear(iterpool);
-
- path = svn_relpath_join(root_dir, node->path, iterpool);
+ const char *path = svn_relpath_join(root_dir, node->path, pool);
if (node->contents)
{
- SVN_ERR(svn_fs_make_file(txn_root, path, iterpool));
+ SVN_ERR(svn_fs_make_file(txn_root, path, pool));
SVN_ERR(svn_test__set_file_contents(txn_root, path, node->contents,
- iterpool));
+ pool));
}
else
{
- SVN_ERR(svn_fs_make_dir(txn_root, path, iterpool));
+ SVN_ERR(svn_fs_make_dir(txn_root, path, pool));
}
}
-
- svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}