Modified: subversion/branches/ev2-export/subversion/libsvn_delta/compat.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_delta/compat.c?rev=1309471&r1=1309470&r2=1309471&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_delta/compat.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_delta/compat.c Wed Apr 4 15:57:38 2012 @@ -1510,6 +1510,7 @@ alter_symlink_cb(void *baton, /* ### do something */ + SVN__NOT_IMPLEMENTED(); return SVN_NO_ERROR; } @@ -1565,6 +1566,7 @@ move_cb(void *baton, svn_revnum_t replaces_rev, apr_pool_t *scratch_pool) { + SVN__NOT_IMPLEMENTED(); return SVN_NO_ERROR; } @@ -1575,6 +1577,7 @@ rotate_cb(void *baton, const apr_array_header_t *revisions, apr_pool_t *scratch_pool) { + SVN__NOT_IMPLEMENTED(); return SVN_NO_ERROR; }
Modified: subversion/branches/ev2-export/subversion/libsvn_delta/xdelta.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_delta/xdelta.c?rev=1309471&r1=1309470&r2=1309471&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_delta/xdelta.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_delta/xdelta.c Wed Apr 4 15:57:38 2012 @@ -44,7 +44,7 @@ */ #define MATCH_BLOCKSIZE 64 -/* "no" / "invalid" / "unused" value for positions within the detla windows +/* "no" / "invalid" / "unused" value for positions within the delta windows */ #define NO_POSITION ((apr_uint32_t)-1) Modified: subversion/branches/ev2-export/subversion/libsvn_fs_base/bdb/env.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_fs_base/bdb/env.c?rev=1309471&r1=1309470&r2=1309471&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_fs_base/bdb/env.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_fs_base/bdb/env.c Wed Apr 4 15:57:38 2012 @@ -490,9 +490,29 @@ bdb_close(bdb_env_t *bdb) static svn_error_t * -svn_fs_bdb__close_internal(bdb_env_t *bdb) +svn_fs_bdb__close_internal(bdb_env_baton_t *bdb_baton) { svn_error_t *err = SVN_NO_ERROR; + bdb_env_t *bdb = bdb_baton->bdb; + + SVN_ERR_ASSERT(bdb_baton->error_info->refcount > 0); + + /* Neutralize bdb_baton's pool cleanup to prevent double-close. See + cleanup_env_baton(). */ + bdb_baton->bdb = NULL; + + /* Note that we only bother with this cleanup if the pool is non-NULL, to + guard against potential races between this and the cleanup_env cleanup + callback. It's not clear if that can actually happen, but better safe + than sorry. */ + if (0 == --bdb_baton->error_info->refcount && bdb->pool) + { + svn_error_clear(bdb_baton->error_info->pending_errors); +#if APR_HAS_THREADS + free(bdb_baton->error_info); + apr_threadkey_private_set(NULL, bdb->error_info); +#endif + } if (--bdb->refcount != 0) { @@ -520,29 +540,10 @@ svn_fs_bdb__close_internal(bdb_env_t *bd svn_error_t * svn_fs_bdb__close(bdb_env_baton_t *bdb_baton) { - bdb_env_t *bdb = bdb_baton->bdb; - SVN_ERR_ASSERT(bdb_baton->env == bdb_baton->bdb->env); - /* Neutralize bdb_baton's pool cleanup to prevent double-close. See - cleanup_env_baton(). */ - bdb_baton->bdb = NULL; - - /* Note that we only bother with this cleanup if the pool is non-NULL, to - guard against potential races between this and the cleanup_env cleanup - callback. It's not clear if that can actually happen, but better safe - than sorry. */ - if (0 == --bdb_baton->error_info->refcount && bdb->pool) - { - svn_error_clear(bdb_baton->error_info->pending_errors); -#if APR_HAS_THREADS - free(bdb_baton->error_info); - apr_threadkey_private_set(NULL, bdb->error_info); -#endif - } - /* This may run during final pool cleanup when the lock is NULL. */ - SVN_MUTEX__WITH_LOCK(bdb_cache_lock, svn_fs_bdb__close_internal(bdb)); + SVN_MUTEX__WITH_LOCK(bdb_cache_lock, svn_fs_bdb__close_internal(bdb_baton)); return SVN_NO_ERROR; } Modified: subversion/branches/ev2-export/subversion/libsvn_subr/crypto.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/crypto.c?rev=1309471&r1=1309470&r2=1309471&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_subr/crypto.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_subr/crypto.c Wed Apr 4 15:57:38 2012 @@ -37,21 +37,17 @@ #define NUM_ITERATIONS 1000 -/* Set this define if we need stronger randomness. (Or if that - decision is permanent, just remove this #define and enable the code - below which uses it to conditionalize functionality.) */ -#define NEED_RANDOMER_RANDOMNESS 0 - - /* A structure for containing Subversion's cryptography-related bits (so we can avoid passing around APR-isms outside this module). */ struct svn_crypto__ctx_t { apr_crypto_t *crypto; /* APR cryptography context. */ -#if NEED_RANDOMER_RANDOMNESS - /* ### For now, we will use apr_generate_random_bytes(). If we need more - ### strength, then we can use that function to generate entropy for - ### seeding apr_random_t. See httpd/server/core.c:ap_init_rng() */ +#if 0 + /* ### For now, we will use apr_generate_random_bytes(). If we need + ### more strength, then we can set this member using + ### apr_random_standard_new(), then use + ### apr_generate_random_bytes() to generate entropy for seeding + ### apr_random_t. See httpd/server/core.c:ap_init_rng() */ apr_random_t *rand; #endif }; @@ -174,11 +170,6 @@ svn_crypto__context_create(svn_crypto__c *ctx = apr_palloc(result_pool, sizeof(**ctx)); -#if NEED_RANDOMER_RANDOMNESS - /* ### Seeding with entropy is needed. See svn_crypto__ctx_t comments. */ - ctx->rand = apr_random_standard_new(result_pool); -#endif - apr_err = apr_crypto_get_driver(&driver, "openssl", NULL, &apu_err, result_pool); /* Potential bugs in get_driver() imply we might get APR_SUCCESS and NULL. Modified: subversion/branches/ev2-export/subversion/libsvn_subr/svn_string.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/svn_string.c?rev=1309471&r1=1309470&r2=1309471&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_subr/svn_string.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_subr/svn_string.c Wed Apr 4 15:57:38 2012 @@ -255,7 +255,7 @@ svn_stringbuf__morph_into_string(svn_str */ #ifdef SVN_DEBUG strbuf->pool = NULL; - strbuf->blocksize = strbuf->len; + strbuf->blocksize = strbuf->len + 1; #endif /* Both, svn_string_t and svn_stringbuf_t are public API structures @@ -441,6 +441,8 @@ svn_stringbuf_isempty(const svn_stringbu void svn_stringbuf_ensure(svn_stringbuf_t *str, apr_size_t minimum_size) { + ++minimum_size; /* + space for '\0' */ + /* Keep doubling capacity until have enough. */ if (str->blocksize < minimum_size) { Modified: subversion/branches/ev2-export/subversion/libsvn_subr/time.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/time.c?rev=1309471&r1=1309470&r2=1309471&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_subr/time.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_subr/time.c Wed Apr 4 15:57:38 2012 @@ -116,14 +116,14 @@ svn_time_to_cstring(apr_time_t when, apr } -static int +static apr_int32_t find_matching_string(char *str, apr_size_t size, const char strings[][4]) { apr_size_t i; for (i = 0; i < size; i++) if (strings[i] && (strcmp(str, strings[i]) == 0)) - return i; + return (apr_int32_t) i; return -1; } @@ -140,19 +140,19 @@ svn_time_from_cstring(apr_time_t *when, /* Open-code parsing of the new timestamp format, as this is a hot path for reading the entries file. This format looks like: "2001-08-31T04:24:14.966996Z" */ - exploded_time.tm_year = strtol(data, &c, 10); + exploded_time.tm_year = (apr_int32_t) strtol(data, &c, 10); if (*c++ != '-') goto fail; - exploded_time.tm_mon = strtol(c, &c, 10); + exploded_time.tm_mon = (apr_int32_t) strtol(c, &c, 10); if (*c++ != '-') goto fail; - exploded_time.tm_mday = strtol(c, &c, 10); + exploded_time.tm_mday = (apr_int32_t) strtol(c, &c, 10); if (*c++ != 'T') goto fail; - exploded_time.tm_hour = strtol(c, &c, 10); + exploded_time.tm_hour = (apr_int32_t) strtol(c, &c, 10); if (*c++ != ':') goto fail; - exploded_time.tm_min = strtol(c, &c, 10); + exploded_time.tm_min = (apr_int32_t) strtol(c, &c, 10); if (*c++ != ':') goto fail; - exploded_time.tm_sec = strtol(c, &c, 10); + exploded_time.tm_sec = (apr_int32_t) strtol(c, &c, 10); if (*c++ != '.') goto fail; - exploded_time.tm_usec = strtol(c, &c, 10); + exploded_time.tm_usec = (apr_int32_t) strtol(c, &c, 10); if (*c++ != 'Z') goto fail; exploded_time.tm_year -= 1900; Modified: subversion/branches/ev2-export/subversion/svnrdump/load_editor.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svnrdump/load_editor.c?rev=1309471&r1=1309470&r2=1309471&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/svnrdump/load_editor.c (original) +++ subversion/branches/ev2-export/subversion/svnrdump/load_editor.c Wed Apr 4 15:57:38 2012 @@ -384,6 +384,136 @@ lock_retry_func(void *baton, reposlocktoken->data); } + +static svn_error_t * +fetch_base_func(const char **filename, + void *baton, + const char *path, + svn_revnum_t base_revision, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + struct revision_baton *rb = baton; + svn_stream_t *fstream; + svn_error_t *err; + + if (svn_path_is_url(path)) + path = svn_uri_skip_ancestor(rb->pb->root_url, path, scratch_pool); + else if (path[0] == '/') + path += 1; + + if (! SVN_IS_VALID_REVNUM(base_revision)) + base_revision = rb->rev - 1; + + SVN_ERR(svn_stream_open_unique(&fstream, filename, NULL, + svn_io_file_del_on_pool_cleanup, + result_pool, scratch_pool)); + + err = svn_ra_get_file(rb->pb->aux_session, path, base_revision, + fstream, NULL, NULL, scratch_pool); + if (err && err->apr_err == SVN_ERR_FS_NOT_FOUND) + { + svn_error_clear(err); + SVN_ERR(svn_stream_close(fstream)); + + *filename = NULL; + return SVN_NO_ERROR; + } + else if (err) + return svn_error_trace(err); + + SVN_ERR(svn_stream_close(fstream)); + + return SVN_NO_ERROR; +} + +static svn_error_t * +fetch_props_func(apr_hash_t **props, + void *baton, + const char *path, + svn_revnum_t base_revision, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + struct revision_baton *rb = baton; + svn_node_kind_t node_kind; + + if (svn_path_is_url(path)) + path = svn_uri_skip_ancestor(rb->pb->root_url, path, scratch_pool); + else if (path[0] == '/') + path += 1; + + if (! SVN_IS_VALID_REVNUM(base_revision)) + base_revision = rb->rev - 1; + + SVN_ERR(svn_ra_check_path(rb->pb->aux_session, path, base_revision, + &node_kind, scratch_pool)); + + if (node_kind == svn_node_file) + { + SVN_ERR(svn_ra_get_file(rb->pb->aux_session, path, base_revision, + NULL, NULL, props, result_pool)); + } + else if (node_kind == svn_node_dir) + { + apr_array_header_t *tmp_props; + + SVN_ERR(svn_ra_get_dir2(rb->pb->aux_session, NULL, NULL, props, path, + base_revision, 0 /* Dirent fields */, + result_pool)); + tmp_props = svn_prop_hash_to_array(*props, result_pool); + SVN_ERR(svn_categorize_props(tmp_props, NULL, NULL, &tmp_props, + result_pool)); + *props = svn_prop_array_to_hash(tmp_props, result_pool); + } + else + { + *props = apr_hash_make(result_pool); + } + + return SVN_NO_ERROR; +} + +static svn_error_t * +fetch_kind_func(svn_kind_t *kind, + void *baton, + const char *path, + svn_revnum_t base_revision, + apr_pool_t *scratch_pool) +{ + struct revision_baton *rb = baton; + svn_node_kind_t node_kind; + + if (svn_path_is_url(path)) + path = svn_uri_skip_ancestor(rb->pb->root_url, path, scratch_pool); + else if (path[0] == '/') + path += 1; + + if (! SVN_IS_VALID_REVNUM(base_revision)) + base_revision = rb->rev - 1; + + SVN_ERR(svn_ra_check_path(rb->pb->aux_session, path, base_revision, + &node_kind, scratch_pool)); + + *kind = svn__kind_from_node_kind(node_kind, FALSE); + return SVN_NO_ERROR; +} + +static svn_delta_shim_callbacks_t * +get_shim_callbacks(struct revision_baton *rb, + apr_pool_t *pool) +{ + svn_delta_shim_callbacks_t *callbacks = + svn_delta_shim_callbacks_default(pool); + + callbacks->fetch_props_func = fetch_props_func; + callbacks->fetch_kind_func = fetch_kind_func; + callbacks->fetch_base_func = fetch_base_func; + callbacks->fetch_baton = rb; + + return callbacks; +} + /* Acquire a lock (of sorts) on the repository associated with the * given RA SESSION. This lock is just a revprop change attempt in a * time-delay loop. This function is duplicated by svnsync in main.c. @@ -518,6 +648,8 @@ new_node_record(void **node_baton, apr_hash_set(rb->revprop_table, SVN_PROP_REVISION_DATE, APR_HASH_KEY_STRING, NULL); + SVN_ERR(svn_ra__register_editor_shim_callbacks(rb->pb->session, + get_shim_callbacks(rb, rb->pool))); SVN_ERR(svn_ra_get_commit_editor3(rb->pb->session, &commit_editor, &commit_edit_baton, rb->revprop_table, commit_callback, revision_baton, Modified: subversion/branches/ev2-export/subversion/tests/cmdline/copy_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/copy_tests.py?rev=1309471&r1=1309470&r2=1309471&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/tests/cmdline/copy_tests.py (original) +++ subversion/branches/ev2-export/subversion/tests/cmdline/copy_tests.py Wed Apr 4 15:57:38 2012 @@ -25,7 +25,9 @@ ###################################################################### # General modules -import stat, os, re, shutil +import stat, os, re, shutil, logging + +logger = logging.getLogger() # Our testing module import svntest @@ -812,7 +814,7 @@ def copy_preserve_executable_bit(sbox): mode2 = os.stat(newpath1)[stat.ST_MODE] if mode1 == mode2: - print("setting svn:executable did not change file's permissions") + logger.warn("setting svn:executable did not change file's permissions") raise svntest.Failure # Commit the file @@ -827,7 +829,7 @@ def copy_preserve_executable_bit(sbox): # The mode on the original and copied file should be identical if mode2 != mode3: - print("permissions on the copied file are not identical to original file") + logger.warn("permissions on the copied file are not identical to original file") raise svntest.Failure #---------------------------------------------------------------------- @@ -942,13 +944,13 @@ def repos_to_wc(sbox): # Modification will only show up if timestamps differ exit_code, out, err = svntest.main.run_svn(None, 'diff', pi_path) if err or not out: - print("diff failed") + logger.warn("diff failed") raise svntest.Failure for line in out: if line == '+zig\n': # Crude check for diff-like output break else: - print("diff output incorrect %s" % out) + logger.warn("diff output incorrect %s" % out) raise svntest.Failure # Revert everything and verify. @@ -1367,7 +1369,7 @@ def revision_kinds_local_source(sbox): if line.rstrip() == "Copied From Rev: " + str(from_rev): break else: - print("%s should have been copied from revision %s" % (dst, from_rev)) + logger.warn("%s should have been copied from revision %s" % (dst, from_rev)) raise svntest.Failure # Check that the new files have the right contents @@ -1625,7 +1627,7 @@ def url_to_non_existent_url_path(sbox): if re.match (msg, err_line): break else: - print("message \"%s\" not found in error output: %s" % (msg, err)) + logger.warn("message \"%s\" not found in error output: %s" % (msg, err)) raise svntest.Failure Modified: subversion/branches/ev2-export/subversion/tests/libsvn_client/client-test.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/libsvn_client/client-test.c?rev=1309471&r1=1309470&r2=1309471&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/tests/libsvn_client/client-test.c (original) +++ subversion/branches/ev2-export/subversion/tests/libsvn_client/client-test.c Wed Apr 4 15:57:38 2012 @@ -656,14 +656,14 @@ test_youngest_common_ancestor(const svn_ apr_pool_t *pool) { const char *repos_url; + const char *repos_uuid = "fake-uuid"; /* the functions we call don't care */ svn_client_ctx_t *ctx; svn_opt_revision_t head_rev = { svn_opt_revision_head, { 0 } }; svn_opt_revision_t zero_rev = { svn_opt_revision_number, { 0 } }; svn_client_copy_source_t source; apr_array_header_t *sources; const char *dest; - const char *yc_ancestor_relpath; - svn_revnum_t yc_ancestor_rev; + svn_client__pathrev_t *yc_ancestor; /* Create a filesytem and repository containing the Greek tree. */ SVN_ERR(create_greek_repos(&repos_url, "test-youngest-common-ancestor", opts, pool)); @@ -684,12 +684,15 @@ test_youngest_common_ancestor(const svn_ /* Test: YCA(iota@2, A/iota@2) is iota@1. */ SVN_ERR(svn_client__get_youngest_common_ancestor( - &yc_ancestor_relpath, NULL, &yc_ancestor_rev, - svn_path_url_add_component2(repos_url, "iota", pool), 2, - svn_path_url_add_component2(repos_url, "A/iota", pool), 2, - ctx, pool)); - SVN_TEST_STRING_ASSERT(yc_ancestor_relpath, "iota"); - SVN_TEST_ASSERT(yc_ancestor_rev == 1); + &yc_ancestor, + svn_client__pathrev_create_with_relpath( + repos_url, repos_uuid, 2, "iota", pool), + svn_client__pathrev_create_with_relpath( + repos_url, repos_uuid, 2, "A/iota", pool), + ctx, pool, pool)); + SVN_TEST_STRING_ASSERT(svn_client__pathrev_relpath(yc_ancestor, pool), + "iota"); + SVN_TEST_ASSERT(yc_ancestor->rev == 1); /* Copy the root directory (at revision 0) into A as 'ROOT'. */ sources = apr_array_make(pool, 1, sizeof(svn_client_copy_source_t *)); @@ -705,12 +708,14 @@ test_youngest_common_ancestor(const svn_ /* Test: YCA(''@0, A/ROOT@3) is ''@0 (handled as a special case). */ SVN_ERR(svn_client__get_youngest_common_ancestor( - &yc_ancestor_relpath, NULL, &yc_ancestor_rev, - svn_path_url_add_component2(repos_url, "", pool), 0, - svn_path_url_add_component2(repos_url, "A/ROOT", pool), 3, - ctx, pool)); - SVN_TEST_STRING_ASSERT(yc_ancestor_relpath, ""); - SVN_TEST_ASSERT(yc_ancestor_rev == 0); + &yc_ancestor, + svn_client__pathrev_create_with_relpath( + repos_url, repos_uuid, 0, "", pool), + svn_client__pathrev_create_with_relpath( + repos_url, repos_uuid, 3, "A/ROOT", pool), + ctx, pool, pool)); + SVN_TEST_STRING_ASSERT(svn_client__pathrev_relpath(yc_ancestor, pool), ""); + SVN_TEST_ASSERT(yc_ancestor->rev == 0); return SVN_NO_ERROR; }
