You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2014/09/10 14:10:14 UTC
svn commit: r1623976 [2/2] - in /subversion/branches/remove-log-addressing:
./ subversion/bindings/ctypes-python/ subversion/bindings/cxxhl/
subversion/include/ subversion/include/private/ subversion/libsvn_client/
subversion/libsvn_fs/ subversion/libs...
Modified: subversion/branches/remove-log-addressing/subversion/libsvn_wc/diff_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/libsvn_wc/diff_editor.c?rev=1623976&r1=1623975&r2=1623976&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/libsvn_wc/diff_editor.c (original)
+++ subversion/branches/remove-log-addressing/subversion/libsvn_wc/diff_editor.c Wed Sep 10 12:10:13 2014
@@ -115,9 +115,6 @@ struct edit_baton_t
/* Possibly diff repos against text-bases instead of working files. */
svn_boolean_t diff_pristine;
- /* Hash whose keys are const char * changelist names. */
- apr_hash_t *changelist_hash;
-
/* Cancel function/baton */
svn_cancel_func_t cancel_func;
void *cancel_baton;
@@ -239,11 +236,6 @@ struct file_baton_t
* calculating diffs. USE_TEXT_BASE defines whether to compare
* against working files or text-bases. REVERSE_ORDER defines which
* direction to perform the diff.
- *
- * CHANGELIST_FILTER is a list of const char * changelist names, used to
- * filter diff output responses to only those items in one of the
- * specified changelists, empty (or NULL altogether) if no changelist
- * filtering is requested.
*/
static svn_error_t *
make_edit_baton(struct edit_baton_t **edit_baton,
@@ -255,20 +247,14 @@ make_edit_baton(struct edit_baton_t **ed
svn_boolean_t ignore_ancestry,
svn_boolean_t use_text_base,
svn_boolean_t reverse_order,
- const apr_array_header_t *changelist_filter,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *pool)
{
- apr_hash_t *changelist_hash = NULL;
struct edit_baton_t *eb;
SVN_ERR_ASSERT(svn_dirent_is_absolute(anchor_abspath));
- if (changelist_filter && changelist_filter->nelts)
- SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelist_filter,
- pool));
-
eb = apr_pcalloc(pool, sizeof(*eb));
eb->db = db;
eb->anchor_abspath = apr_pstrdup(pool, anchor_abspath);
@@ -278,7 +264,6 @@ make_edit_baton(struct edit_baton_t **ed
eb->ignore_ancestry = ignore_ancestry;
eb->local_before_remote = reverse_order;
eb->diff_pristine = use_text_base;
- eb->changelist_hash = changelist_hash;
eb->cancel_func = cancel_func;
eb->cancel_baton = cancel_baton;
eb->pool = pool;
@@ -392,7 +377,6 @@ svn_wc__diff_base_working_diff(svn_wc__d
const char *local_abspath,
const char *relpath,
svn_revnum_t revision,
- apr_hash_t *changelist_hash,
const svn_diff_tree_processor_t *processor,
void *processor_dir_baton,
svn_boolean_t diff_pristine,
@@ -419,12 +403,11 @@ svn_wc__diff_base_working_diff(svn_wc__d
apr_hash_t *base_props;
apr_hash_t *local_props;
apr_array_header_t *prop_changes;
- const char *changelist;
SVN_ERR(svn_wc__db_read_info(&status, NULL, &db_revision, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, &working_checksum, NULL,
NULL, NULL, NULL, NULL, NULL, &recorded_size,
- &recorded_time, &changelist, NULL, NULL,
+ &recorded_time, NULL, NULL, NULL,
&had_props, &props_mod, NULL, NULL, NULL,
db, local_abspath, scratch_pool, scratch_pool));
checksum = working_checksum;
@@ -433,12 +416,6 @@ svn_wc__diff_base_working_diff(svn_wc__d
|| status == svn_wc__db_status_added
|| (status == svn_wc__db_status_deleted && diff_pristine));
- /* If the item is not a member of a specified changelist (and there are
- some specified changelists), skip it. */
- if (changelist_hash && !svn_hash_gets(changelist_hash, changelist))
- return SVN_NO_ERROR;
-
-
if (status != svn_wc__db_status_normal)
{
SVN_ERR(svn_wc__db_base_get_info(&base_status, NULL, &db_revision,
@@ -768,7 +745,6 @@ walk_local_nodes_diff(struct edit_baton_
SVN_ERR(svn_wc__diff_local_only_file(db, child_abspath,
child_relpath,
eb->processor, dir_baton,
- eb->changelist_hash,
eb->diff_pristine,
eb->cancel_func,
eb->cancel_baton,
@@ -778,7 +754,6 @@ walk_local_nodes_diff(struct edit_baton_
child_relpath,
depth_below_here,
eb->processor, dir_baton,
- eb->changelist_hash,
eb->diff_pristine,
eb->cancel_func,
eb->cancel_baton,
@@ -814,7 +789,6 @@ walk_local_nodes_diff(struct edit_baton_
db, child_abspath,
child_relpath,
eb->revnum,
- eb->changelist_hash,
eb->processor, dir_baton,
eb->diff_pristine,
eb->cancel_func,
@@ -837,7 +811,6 @@ walk_local_nodes_diff(struct edit_baton_
SVN_ERR(svn_wc__diff_local_only_file(db, child_abspath,
child_relpath,
eb->processor, dir_baton,
- eb->changelist_hash,
eb->diff_pristine,
eb->cancel_func,
eb->cancel_baton,
@@ -846,7 +819,6 @@ walk_local_nodes_diff(struct edit_baton_
SVN_ERR(svn_wc__diff_local_only_dir(db, child_abspath,
child_relpath, depth_below_here,
eb->processor, dir_baton,
- eb->changelist_hash,
eb->diff_pristine,
eb->cancel_func,
eb->cancel_baton,
@@ -858,13 +830,9 @@ walk_local_nodes_diff(struct edit_baton_
if (compared)
return SVN_NO_ERROR;
- /* Check for local property mods on this directory, if we haven't
- already reported them and we aren't changelist-filted.
- ### it should be noted that we do not currently allow directories
- ### to be part of changelists, so if a changelist is provided, the
- ### changelist check will always fail. */
+ /* Check for local property mods on this directory, if we haven't
+ already reported them. */
if (! skip
- && ! eb->changelist_hash
&& ! in_anchor_not_target
&& props_mod)
{
@@ -907,7 +875,6 @@ svn_wc__diff_local_only_file(svn_wc__db_
const char *relpath,
const svn_diff_tree_processor_t *processor,
void *processor_parent_baton,
- apr_hash_t *changelist_hash,
svn_boolean_t diff_pristine,
svn_cancel_func_t cancel_func,
void *cancel_baton,
@@ -920,7 +887,6 @@ svn_wc__diff_local_only_file(svn_wc__db_
const svn_checksum_t *checksum;
const char *original_repos_relpath;
svn_revnum_t original_revision;
- const char *changelist;
svn_boolean_t had_props;
svn_boolean_t props_mod;
apr_hash_t *pristine_props;
@@ -936,7 +902,7 @@ svn_wc__diff_local_only_file(svn_wc__db_
NULL, NULL, NULL, NULL, &checksum, NULL,
&original_repos_relpath, NULL, NULL,
&original_revision, NULL, NULL, NULL,
- &changelist, NULL, NULL, &had_props,
+ NULL, NULL, NULL, &had_props,
&props_mod, NULL, NULL, NULL,
db, local_abspath,
scratch_pool, scratch_pool));
@@ -947,10 +913,6 @@ svn_wc__diff_local_only_file(svn_wc__db_
|| (status == svn_wc__db_status_deleted && diff_pristine)));
- if (changelist && changelist_hash
- && !svn_hash_gets(changelist_hash, changelist))
- return SVN_NO_ERROR;
-
if (status == svn_wc__db_status_deleted)
{
assert(diff_pristine);
@@ -1053,7 +1015,6 @@ svn_wc__diff_local_only_dir(svn_wc__db_t
svn_depth_t depth,
const svn_diff_tree_processor_t *processor,
void *processor_parent_baton,
- apr_hash_t *changelist_hash,
svn_boolean_t diff_pristine,
svn_cancel_func_t cancel_func,
void *cancel_baton,
@@ -1075,9 +1036,6 @@ svn_wc__diff_local_only_dir(svn_wc__db_t
svn_boolean_t skip_children = FALSE;
svn_diff_source_t *right_src = svn_diff__source_create(SVN_INVALID_REVNUM,
scratch_pool);
- svn_depth_t depth_below_here = depth;
- apr_hash_t *nodes;
- apr_hash_t *conflicts;
SVN_ERR(svn_wc__db_read_info(&status, &kind, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
@@ -1128,71 +1086,81 @@ svn_wc__diff_local_only_dir(svn_wc__db_t
processor,
scratch_pool, iterpool));
- SVN_ERR(svn_wc__db_read_children_info(&nodes, &conflicts, db, local_abspath,
- FALSE /* base_tree_only */,
- scratch_pool, iterpool));
-
- if (depth_below_here == svn_depth_immediates)
- depth_below_here = svn_depth_empty;
-
- children = svn_sort__hash(nodes, svn_sort_compare_items_lexically,
- scratch_pool);
-
- for (i = 0; i < children->nelts; i++)
+ if ((depth > svn_depth_empty || depth == svn_depth_unknown)
+ && ! skip_children)
{
- svn_sort__item_t *item = &APR_ARRAY_IDX(children, i, svn_sort__item_t);
- const char *name = item->key;
- struct svn_wc__db_info_t *info = item->value;
- const char *child_abspath;
- const char *child_relpath;
+ svn_depth_t depth_below_here = depth;
+ apr_hash_t *nodes;
+ apr_hash_t *conflicts;
+
+ if (depth_below_here == svn_depth_immediates)
+ depth_below_here = svn_depth_empty;
- svn_pool_clear(iterpool);
+ SVN_ERR(svn_wc__db_read_children_info(&nodes, &conflicts,
+ db, local_abspath,
+ FALSE /* base_tree_only */,
+ scratch_pool, iterpool));
- if (cancel_func)
- SVN_ERR(cancel_func(cancel_baton));
- child_abspath = svn_dirent_join(local_abspath, name, iterpool);
+ children = svn_sort__hash(nodes, svn_sort_compare_items_lexically,
+ scratch_pool);
- if (NOT_PRESENT(info->status))
+ for (i = 0; i < children->nelts; i++)
{
- continue;
- }
+ svn_sort__item_t *item = &APR_ARRAY_IDX(children, i, svn_sort__item_t);
+ const char *name = item->key;
+ struct svn_wc__db_info_t *info = item->value;
+ const char *child_abspath;
+ const char *child_relpath;
- /* If comparing against WORKING, skip entries that are
- schedule-deleted - they don't really exist. */
- if (!diff_pristine && info->status == svn_wc__db_status_deleted)
- continue;
+ svn_pool_clear(iterpool);
- child_relpath = svn_relpath_join(relpath, name, iterpool);
+ if (cancel_func)
+ SVN_ERR(cancel_func(cancel_baton));
- switch (info->kind)
- {
- case svn_node_file:
- case svn_node_symlink:
- SVN_ERR(svn_wc__diff_local_only_file(db, child_abspath,
- child_relpath,
- processor, pdb,
- changelist_hash,
- diff_pristine,
- cancel_func, cancel_baton,
- scratch_pool));
- break;
+ child_abspath = svn_dirent_join(local_abspath, name, iterpool);
- case svn_node_dir:
- if (depth > svn_depth_files || depth == svn_depth_unknown)
+ if (NOT_PRESENT(info->status))
{
- SVN_ERR(svn_wc__diff_local_only_dir(db, child_abspath,
- child_relpath, depth_below_here,
- processor, pdb,
- changelist_hash,
- diff_pristine,
- cancel_func, cancel_baton,
- iterpool));
+ continue;
}
- break;
- default:
- break;
+ /* If comparing against WORKING, skip entries that are
+ schedule-deleted - they don't really exist. */
+ if (!diff_pristine && info->status == svn_wc__db_status_deleted)
+ continue;
+
+ child_relpath = svn_relpath_join(relpath, name, iterpool);
+
+ switch (info->kind)
+ {
+ case svn_node_file:
+ case svn_node_symlink:
+ SVN_ERR(svn_wc__diff_local_only_file(db, child_abspath,
+ child_relpath,
+ processor, pdb,
+ diff_pristine,
+ cancel_func, cancel_baton,
+ scratch_pool));
+ break;
+
+ case svn_node_dir:
+ if (depth > svn_depth_files || depth == svn_depth_unknown)
+ {
+ SVN_ERR(svn_wc__diff_local_only_dir(db, child_abspath,
+ child_relpath,
+ depth_below_here,
+ processor, pdb,
+ diff_pristine,
+ cancel_func,
+ cancel_baton,
+ iterpool));
+ }
+ break;
+
+ default:
+ break;
+ }
}
}
@@ -1282,7 +1250,6 @@ handle_local_only(struct dir_baton_t *pb
svn_relpath_join(pb->relpath, name, scratch_pool),
repos_delete ? svn_depth_infinity : depth,
eb->processor, pb->pdb,
- eb->changelist_hash,
eb->diff_pristine,
eb->cancel_func, eb->cancel_baton,
scratch_pool));
@@ -1293,7 +1260,6 @@ handle_local_only(struct dir_baton_t *pb
svn_dirent_join(pb->local_abspath, name, scratch_pool),
svn_relpath_join(pb->relpath, name, scratch_pool),
eb->processor, pb->pdb,
- eb->changelist_hash,
eb->diff_pristine,
eb->cancel_func, eb->cancel_baton,
scratch_pool));
@@ -2068,7 +2034,14 @@ close_file(void *file_baton,
const char *repos_file;
apr_hash_t *repos_props;
- if (!fb->skip && expected_md5_digest != NULL)
+ if (fb->skip)
+ {
+ svn_pool_destroy(fb->pool); /* destroys scratch_pool and fb */
+ SVN_ERR(maybe_done(pb));
+ return SVN_NO_ERROR;
+ }
+
+ if (expected_md5_digest != NULL)
{
svn_checksum_t *expected_checksum;
const svn_checksum_t *result_checksum;
@@ -2123,11 +2096,7 @@ close_file(void *file_baton,
}
}
- if (fb->skip)
- {
- /* Diff processor requested skipping information */
- }
- else if (fb->repos_only)
+ if (fb->repos_only)
{
SVN_ERR(eb->processor->file_deleted(fb->relpath,
fb->left_src,
@@ -2307,12 +2276,24 @@ svn_wc__get_diff_editor(const svn_delta_
SVN_ERR_ASSERT(svn_dirent_is_absolute(anchor_abspath));
+ /* Apply changelist filtering to the output */
+ if (changelist_filter && changelist_filter->nelts)
+ {
+ apr_hash_t *changelist_hash;
+
+ SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelist_filter,
+ result_pool));
+ diff_processor = svn_wc__changelist_filter_tree_processor_create(
+ diff_processor, wc_ctx, anchor_abspath,
+ changelist_hash, result_pool);
+ }
+
SVN_ERR(make_edit_baton(&eb,
wc_ctx->db,
anchor_abspath, target,
diff_processor,
depth, ignore_ancestry,
- use_text_base, reverse_order, changelist_filter,
+ use_text_base, reverse_order,
cancel_func, cancel_baton,
result_pool));
@@ -2778,3 +2759,329 @@ svn_wc__wrap_diff_callbacks(const svn_di
*diff_processor = processor;
return SVN_NO_ERROR;
}
+
+/* =====================================================================
+ * A tree processor filter that filters by changelist membership
+ * =====================================================================
+ *
+ * The current implementation queries the WC for the changelist of each
+ * file as it comes through, and sets the 'skip' flag for a non-matching
+ * file.
+ *
+ * (It doesn't set the 'skip' flag for a directory, as we need to receive
+ * the changed/added/deleted/closed call to know when it is closed, in
+ * order to preserve the strict open-close semantics for the wrapped tree
+ * processor.)
+ *
+ * It passes on the opening and closing of every directory, even if there
+ * are no file changes to be passed on inside that directory.
+ */
+
+typedef struct filter_tree_baton_t
+{
+ const svn_diff_tree_processor_t *processor;
+ svn_wc_context_t *wc_ctx;
+ /* WC path of the root of the diff (where relpath = "") */
+ const char *root_local_abspath;
+ /* Hash whose keys are const char * changelist names. */
+ apr_hash_t *changelist_hash;
+} filter_tree_baton_t;
+
+static svn_error_t *
+filter_dir_opened(void **new_dir_baton,
+ svn_boolean_t *skip,
+ svn_boolean_t *skip_children,
+ const char *relpath,
+ const svn_diff_source_t *left_source,
+ const svn_diff_source_t *right_source,
+ const svn_diff_source_t *copyfrom_source,
+ void *parent_dir_baton,
+ const svn_diff_tree_processor_t *processor,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ struct filter_tree_baton_t *fb = processor->baton;
+
+ SVN_ERR(fb->processor->dir_opened(new_dir_baton, skip, skip_children,
+ relpath,
+ left_source, right_source,
+ copyfrom_source,
+ parent_dir_baton,
+ fb->processor,
+ result_pool, scratch_pool));
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+filter_dir_added(const char *relpath,
+ const svn_diff_source_t *copyfrom_source,
+ const svn_diff_source_t *right_source,
+ /*const*/ apr_hash_t *copyfrom_props,
+ /*const*/ apr_hash_t *right_props,
+ void *dir_baton,
+ const svn_diff_tree_processor_t *processor,
+ apr_pool_t *scratch_pool)
+{
+ struct filter_tree_baton_t *fb = processor->baton;
+
+ SVN_ERR(fb->processor->dir_closed(relpath,
+ NULL,
+ right_source,
+ dir_baton,
+ fb->processor,
+ scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+filter_dir_deleted(const char *relpath,
+ const svn_diff_source_t *left_source,
+ /*const*/ apr_hash_t *left_props,
+ void *dir_baton,
+ const svn_diff_tree_processor_t *processor,
+ apr_pool_t *scratch_pool)
+{
+ struct filter_tree_baton_t *fb = processor->baton;
+
+ SVN_ERR(fb->processor->dir_closed(relpath,
+ left_source,
+ NULL,
+ dir_baton,
+ fb->processor,
+ scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+filter_dir_changed(const char *relpath,
+ const svn_diff_source_t *left_source,
+ const svn_diff_source_t *right_source,
+ /*const*/ apr_hash_t *left_props,
+ /*const*/ apr_hash_t *right_props,
+ const apr_array_header_t *prop_changes,
+ void *dir_baton,
+ const struct svn_diff_tree_processor_t *processor,
+ apr_pool_t *scratch_pool)
+{
+ struct filter_tree_baton_t *fb = processor->baton;
+
+ SVN_ERR(fb->processor->dir_closed(relpath,
+ left_source,
+ right_source,
+ dir_baton,
+ fb->processor,
+ scratch_pool));
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+filter_dir_closed(const char *relpath,
+ const svn_diff_source_t *left_source,
+ const svn_diff_source_t *right_source,
+ void *dir_baton,
+ const svn_diff_tree_processor_t *processor,
+ apr_pool_t *scratch_pool)
+{
+ struct filter_tree_baton_t *fb = processor->baton;
+
+ SVN_ERR(fb->processor->dir_closed(relpath,
+ left_source,
+ right_source,
+ dir_baton,
+ fb->processor,
+ scratch_pool));
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+filter_file_opened(void **new_file_baton,
+ svn_boolean_t *skip,
+ const char *relpath,
+ const svn_diff_source_t *left_source,
+ const svn_diff_source_t *right_source,
+ const svn_diff_source_t *copyfrom_source,
+ void *dir_baton,
+ const svn_diff_tree_processor_t *processor,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ struct filter_tree_baton_t *fb = processor->baton;
+ const char *local_abspath
+ = svn_dirent_join(fb->root_local_abspath, relpath, scratch_pool);
+
+ /* Skip if not a member of a given changelist */
+ if (! svn_wc__changelist_match(fb->wc_ctx, local_abspath,
+ fb->changelist_hash, scratch_pool))
+ {
+ *skip = TRUE;
+ return SVN_NO_ERROR;
+ }
+
+ SVN_ERR(fb->processor->file_opened(new_file_baton,
+ skip,
+ relpath,
+ left_source,
+ right_source,
+ copyfrom_source,
+ dir_baton,
+ fb->processor,
+ result_pool,
+ scratch_pool));
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+filter_file_added(const char *relpath,
+ const svn_diff_source_t *copyfrom_source,
+ const svn_diff_source_t *right_source,
+ const char *copyfrom_file,
+ const char *right_file,
+ /*const*/ apr_hash_t *copyfrom_props,
+ /*const*/ apr_hash_t *right_props,
+ void *file_baton,
+ const svn_diff_tree_processor_t *processor,
+ apr_pool_t *scratch_pool)
+{
+ struct filter_tree_baton_t *fb = processor->baton;
+
+ SVN_ERR(fb->processor->file_added(relpath,
+ copyfrom_source,
+ right_source,
+ copyfrom_file,
+ right_file,
+ copyfrom_props,
+ right_props,
+ file_baton,
+ fb->processor,
+ scratch_pool));
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+filter_file_deleted(const char *relpath,
+ const svn_diff_source_t *left_source,
+ const char *left_file,
+ /*const*/ apr_hash_t *left_props,
+ void *file_baton,
+ const svn_diff_tree_processor_t *processor,
+ apr_pool_t *scratch_pool)
+{
+ struct filter_tree_baton_t *fb = processor->baton;
+
+ SVN_ERR(fb->processor->file_deleted(relpath,
+ left_source,
+ left_file,
+ left_props,
+ file_baton,
+ fb->processor,
+ scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+filter_file_changed(const char *relpath,
+ const svn_diff_source_t *left_source,
+ const svn_diff_source_t *right_source,
+ const char *left_file,
+ const char *right_file,
+ /*const*/ apr_hash_t *left_props,
+ /*const*/ apr_hash_t *right_props,
+ svn_boolean_t file_modified,
+ const apr_array_header_t *prop_changes,
+ void *file_baton,
+ const svn_diff_tree_processor_t *processor,
+ apr_pool_t *scratch_pool)
+{
+ struct filter_tree_baton_t *fb = processor->baton;
+
+ SVN_ERR(fb->processor->file_changed(relpath,
+ left_source,
+ right_source,
+ left_file,
+ right_file,
+ left_props,
+ right_props,
+ file_modified,
+ prop_changes,
+ file_baton,
+ fb->processor,
+ scratch_pool));
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+filter_file_closed(const char *relpath,
+ const svn_diff_source_t *left_source,
+ const svn_diff_source_t *right_source,
+ void *file_baton,
+ const svn_diff_tree_processor_t *processor,
+ apr_pool_t *scratch_pool)
+{
+ struct filter_tree_baton_t *fb = processor->baton;
+
+ SVN_ERR(fb->processor->file_closed(relpath,
+ left_source,
+ right_source,
+ file_baton,
+ fb->processor,
+ scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+filter_node_absent(const char *relpath,
+ void *dir_baton,
+ const svn_diff_tree_processor_t *processor,
+ apr_pool_t *scratch_pool)
+{
+ struct filter_tree_baton_t *fb = processor->baton;
+
+ SVN_ERR(fb->processor->node_absent(relpath,
+ dir_baton,
+ fb->processor,
+ scratch_pool));
+ return SVN_NO_ERROR;
+}
+
+const svn_diff_tree_processor_t *
+svn_wc__changelist_filter_tree_processor_create(
+ const svn_diff_tree_processor_t *processor,
+ svn_wc_context_t *wc_ctx,
+ const char *root_local_abspath,
+ apr_hash_t *changelist_hash,
+ apr_pool_t *result_pool)
+{
+ struct filter_tree_baton_t *fb;
+ svn_diff_tree_processor_t *filter;
+
+ if (! changelist_hash)
+ return processor;
+
+ fb = apr_pcalloc(result_pool, sizeof(*fb));
+ fb->processor = processor;
+ fb->wc_ctx = wc_ctx;
+ fb->root_local_abspath = root_local_abspath;
+ fb->changelist_hash = changelist_hash;
+
+ filter = svn_diff__tree_processor_create(fb, result_pool);
+ filter->dir_opened = filter_dir_opened;
+ filter->dir_added = filter_dir_added;
+ filter->dir_deleted = filter_dir_deleted;
+ filter->dir_changed = filter_dir_changed;
+ filter->dir_closed = filter_dir_closed;
+
+ filter->file_opened = filter_file_opened;
+ filter->file_added = filter_file_added;
+ filter->file_deleted = filter_file_deleted;
+ filter->file_changed = filter_file_changed;
+ filter->file_closed = filter_file_closed;
+
+ filter->node_absent = filter_node_absent;
+
+ return filter;
+}
+
Modified: subversion/branches/remove-log-addressing/subversion/libsvn_wc/diff_local.c
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/libsvn_wc/diff_local.c?rev=1623976&r1=1623975&r2=1623976&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/libsvn_wc/diff_local.c (original)
+++ subversion/branches/remove-log-addressing/subversion/libsvn_wc/diff_local.c Wed Sep 10 12:10:13 2014
@@ -89,9 +89,6 @@ struct diff_baton
/* Should this diff ignore node ancestry? */
svn_boolean_t ignore_ancestry;
- /* Hash whose keys are const char * changelist names. */
- apr_hash_t *changelist_hash;
-
/* Cancel function/baton */
svn_cancel_func_t cancel_func;
void *cancel_baton;
@@ -249,11 +246,6 @@ diff_status_callback(void *baton,
if (eb->cur && eb->cur->skip_children)
return SVN_NO_ERROR;
- if (eb->changelist_hash != NULL
- && (!status->changelist
- || ! svn_hash_gets(eb->changelist_hash, status->changelist)))
- return SVN_NO_ERROR; /* Filtered via changelist */
-
/* This code does about the same thing as the inner body of
walk_local_nodes_diff() in diff_editor.c, except that
it is already filtered by the status walker, doesn't have to
@@ -358,7 +350,6 @@ diff_status_callback(void *baton,
SVN_ERR(svn_wc__diff_base_working_diff(db, child_abspath,
child_relpath,
SVN_INVALID_REVNUM,
- eb->changelist_hash,
eb->processor,
eb->cur
? eb->cur->baton
@@ -402,7 +393,6 @@ diff_status_callback(void *baton,
child_relpath,
eb->processor,
eb->cur ? eb->cur->baton : NULL,
- eb->changelist_hash,
FALSE,
eb->cancel_func,
eb->cancel_baton,
@@ -412,7 +402,6 @@ diff_status_callback(void *baton,
child_relpath, depth_below_here,
eb->processor,
eb->cur ? eb->cur->baton : NULL,
- eb->changelist_hash,
FALSE,
eb->cancel_func,
eb->cancel_baton,
@@ -475,15 +464,23 @@ svn_wc__diff7(const char **root_relpath,
if (root_is_dir)
*root_is_dir = (kind == svn_node_dir);
+ /* Apply changelist filtering to the output */
+ if (changelist_filter && changelist_filter->nelts)
+ {
+ apr_hash_t *changelist_hash;
+
+ SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelist_filter,
+ result_pool));
+ diff_processor = svn_wc__changelist_filter_tree_processor_create(
+ diff_processor, wc_ctx, local_abspath,
+ changelist_hash, result_pool);
+ }
+
eb.db = wc_ctx->db;
eb.processor = diff_processor;
eb.ignore_ancestry = ignore_ancestry;
eb.pool = scratch_pool;
- if (changelist_filter && changelist_filter->nelts)
- SVN_ERR(svn_hash_from_cstring_keys(&eb.changelist_hash, changelist_filter,
- scratch_pool));
-
if (ignore_ancestry)
get_all = TRUE; /* We need unmodified descendants of copies */
else
Modified: subversion/branches/remove-log-addressing/subversion/mod_dav_svn/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/mod_dav_svn/lock.c?rev=1623976&r1=1623975&r2=1623976&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/mod_dav_svn/lock.c (original)
+++ subversion/branches/remove-log-addressing/subversion/mod_dav_svn/lock.c Wed Sep 10 12:10:13 2014
@@ -787,7 +787,31 @@ append_locks(dav_lockdb *lockdb,
DAV_ERR_LOCK_SAVE_LOCK,
"Anonymous lock creation is not allowed.");
}
- else if (serr && (serr->apr_err == SVN_ERR_REPOS_HOOK_FAILURE ||
+ else if (serr && serr->apr_err == SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED)
+ {
+ /* The lock was created in the repository, so we should report the node
+ as locked to the client */
+
+ /* First log the hook failure, for diagnostics. This clears serr */
+ dav_svn__log_err(info->r,
+ dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
+ "Post lock hook failure.",
+ resource->pool),
+ APLOG_WARNING);
+
+ /* How can we report the error to the client?
+
+ We can't return an error code, as that would make it impossible
+ to return the lock details?
+
+ Add yet another custom header?
+ Just an header doesn't handle a full error chain...
+
+ ### Current behavior: we don't report an error.
+ */
+
+ }
+ else if (serr && (svn_error_find_cause(serr, SVN_ERR_REPOS_HOOK_FAILURE) ||
serr->apr_err == SVN_ERR_FS_NO_SUCH_LOCK ||
serr->apr_err == SVN_ERR_FS_LOCK_EXPIRED ||
SVN_ERR_IS_LOCK_ERROR(serr)))
@@ -897,6 +921,22 @@ remove_lock(dav_lockdb *lockdb,
DAV_ERR_LOCK_SAVE_LOCK,
"Anonymous lock removal is not allowed.");
}
+ else if (serr && serr->apr_err == SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED
+ && !resource->info->repos->is_svn_client)
+ {
+ /* Generic DAV clients don't understand the specific error code we
+ would produce here as being just a warning, so lets produce a
+ success result. We removed the lock anyway. */
+
+ /* First log the hook failure, for diagnostics. This clears serr */
+ dav_svn__log_err(info->r,
+ dav_svn__convert_err(serr,
+ HTTP_INTERNAL_SERVER_ERROR,
+ "Post unlock hook failure.",
+ resource->pool),
+ APLOG_WARNING);
+
+ }
else if (serr)
return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
"Failed to remove a lock.",
@@ -1016,7 +1056,7 @@ refresh_locks(dav_lockdb *lockdb,
DAV_ERR_LOCK_SAVE_LOCK,
"Anonymous lock refreshing is not allowed.");
}
- else if (serr && (serr->apr_err == SVN_ERR_REPOS_HOOK_FAILURE ||
+ else if (serr && (svn_error_find_cause(serr, SVN_ERR_REPOS_HOOK_FAILURE) ||
serr->apr_err == SVN_ERR_FS_NO_SUCH_LOCK ||
serr->apr_err == SVN_ERR_FS_LOCK_EXPIRED ||
SVN_ERR_IS_LOCK_ERROR(serr)))
Propchange: subversion/branches/remove-log-addressing/subversion/mod_dav_svn/status.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/remove-log-addressing/subversion/mod_dav_svn/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/mod_dav_svn/util.c?rev=1623976&r1=1623975&r2=1623976&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/mod_dav_svn/util.c (original)
+++ subversion/branches/remove-log-addressing/subversion/mod_dav_svn/util.c Wed Sep 10 12:10:13 2014
@@ -152,7 +152,7 @@ dav_svn__convert_err(svn_error_t *serr,
derr = build_error_chain(pool, purged_serr, status);
if (message != NULL
- && purged_serr->apr_err != SVN_ERR_REPOS_HOOK_FAILURE)
+ && !svn_error_find_cause(purged_serr, SVN_ERR_REPOS_HOOK_FAILURE))
/* Don't hide hook failures; we might hide the error text */
derr = dav_push_error(pool, status, purged_serr->apr_err,
message, derr);
Modified: subversion/branches/remove-log-addressing/subversion/svnfsfs/stats-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/svnfsfs/stats-cmd.c?rev=1623976&r1=1623975&r2=1623976&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/svnfsfs/stats-cmd.c (original)
+++ subversion/branches/remove-log-addressing/subversion/svnfsfs/stats-cmd.c Wed Sep 10 12:10:13 2014
@@ -33,6 +33,7 @@
#include "../libsvn_fs_fs/pack.h"
#include "../libsvn_fs_fs/rev_file.h"
#include "../libsvn_fs_fs/util.h"
+#include "../libsvn_fs_fs/fs_fs.h"
#include "../libsvn_fs/fs-loader.h"
#include "svn_private_config.h"
@@ -225,6 +226,15 @@ typedef struct fs_t
/* FS API object*/
svn_fs_t *fs;
+ /* The HEAD revision. */
+ svn_revnum_t head;
+
+ /* Number of revs per shard; 0 for non-sharded repos. */
+ int shard_size;
+
+ /* First non-packed revision. */
+ svn_revnum_t min_unpacked_rev;
+
/* all revisions */
apr_array_header_t *revisions;
@@ -603,17 +613,16 @@ read_revision_header(apr_size_t *changes
static svn_error_t *
fs_open(fs_t **fs, const char *path, apr_pool_t *pool)
{
- fs_fs_data_t *ffd;
-
*fs = apr_pcalloc(pool, sizeof(**fs));
/* Check repository type and open it. */
SVN_ERR(open_fs(&(*fs)->fs, path, pool));
- /* Check the FS format number. */
- ffd = (*fs)->fs->fsap_data;
- if ((ffd->format != 4) && (ffd->format != 6) && (ffd->format != 7))
- return svn_error_create(SVN_ERR_FS_UNSUPPORTED_FORMAT, NULL, NULL);
+ /* Read repository dimensions. */
+ (*fs)->shard_size = svn_fs_fs__shard_size((*fs)->fs);
+ SVN_ERR(svn_fs_fs__youngest_rev(&(*fs)->head, (*fs)->fs, pool));
+ SVN_ERR(svn_fs_fs__min_unpacked_rev(&(*fs)->min_unpacked_rev, (*fs)->fs,
+ pool));
return SVN_NO_ERROR;
}
@@ -798,13 +807,13 @@ parse_representation(rep_stats_t **repre
result->offset = (apr_size_t)offset;
result->size = (apr_size_t)size;
- SVN_ERR(read_rep_base(&result->delta_base, &header_size,
- &is_plain, fs, file_content,
- (apr_size_t)offset,
- pool, scratch_pool));
+ SVN_ERR(read_rep_base(&result->delta_base, &header_size,
+ &is_plain, fs, file_content,
+ (apr_size_t)offset,
+ pool, scratch_pool));
- result->header_size = header_size;
- result->is_plain = is_plain;
+ result->header_size = header_size;
+ result->is_plain = is_plain;
svn_sort__array_insert(revision_info->representations, &result, idx);
}
@@ -1228,13 +1237,12 @@ read_phys_pack_file(fs_t *fs,
int i;
apr_off_t file_size = 0;
apr_file_t *file;
- fs_fs_data_t *ffd = fs->fs->fsap_data;
SVN_ERR(open_rev_or_pack_file(&file, fs, base, local_pool));
SVN_ERR(get_file_size(&file_size, file, local_pool));
/* process each revision in the pack file */
- for (i = 0; i < ffd->max_files_per_dir; ++i)
+ for (i = 0; i < fs->shard_size; ++i)
{
apr_size_t root_node_offset;
svn_stringbuf_t *rev_content;
@@ -1246,7 +1254,7 @@ read_phys_pack_file(fs_t *fs,
info->revision = base + i;
SVN_ERR(svn_fs_fs__get_packed_offset(&info->offset, fs->fs, base + i,
iter_pool));
- if (i + 1 == ffd->max_files_per_dir)
+ if (i + 1 == fs->shard_size)
SVN_ERR(svn_io_file_seek(file, APR_END, &info->end, iter_pool));
else
SVN_ERR(svn_fs_fs__get_packed_offset(&info->end, fs->fs,
@@ -1297,7 +1305,6 @@ read_phys_revision_file(fs_t *fs,
revision_info_t *info = apr_pcalloc(pool, sizeof(*info));
apr_off_t file_size = 0;
apr_file_t *file;
- fs_fs_data_t *ffd = fs->fs->fsap_data;
/* read the whole pack file into memory */
SVN_ERR(open_rev_or_pack_file(&file, fs, revision, local_pool));
@@ -1332,7 +1339,9 @@ read_phys_revision_file(fs_t *fs,
pool, local_pool));
/* show progress every 1000 revs or so */
- if (revision % ffd->max_files_per_dir == 0)
+ if (fs->shard_size && (revision % fs->shard_size == 0))
+ print_progress(revision);
+ if (!fs->shard_size && (revision % 1000 == 0))
print_progress(revision);
svn_pool_destroy(local_pool);
@@ -1349,11 +1358,9 @@ read_revisions(fs_t **fs,
apr_pool_t *pool)
{
svn_revnum_t revision;
- fs_fs_data_t *ffd;
/* determine cache sizes */
SVN_ERR(fs_open(fs, path, pool));
- ffd = (*fs)->fs->fsap_data;
/* create data containers and caches
* Note: this assumes that int is at least 32-bits and that we only support
@@ -1361,8 +1368,7 @@ read_revisions(fs_t **fs,
* of both the nelts field of the array and our revision numbers). This
* means this code will fail on platforms where int is less than 32-bits
* and the repository has more revisions than int can hold. */
- (*fs)->revisions = apr_array_make(pool,
- (int) ffd->youngest_rev_cache + 1,
+ (*fs)->revisions = apr_array_make(pool, (int) (*fs)->head + 1,
sizeof(revision_info_t *));
(*fs)->null_base = apr_pcalloc(pool, sizeof(*(*fs)->null_base));
initialize_largest_changes(*fs, 64, pool);
@@ -1377,14 +1383,14 @@ read_revisions(fs_t **fs,
FALSE, pool, pool));
/* read all packed revs */
- for ( revision = 0
- ; revision < ffd->min_unpacked_rev
- ; revision += ffd->max_files_per_dir)
+ for ( revision = 0
+ ; revision < (*fs)->min_unpacked_rev
+ ; revision += (*fs)->shard_size)
{
SVN_ERR(read_phys_pack_file(*fs, revision, pool));
}
/* read non-packed revs */
- for ( ; revision <= ffd->youngest_rev_cache; ++revision)
+ for ( ; revision <= (*fs)->head; ++revision)
{
SVN_ERR(read_phys_revision_file(*fs, revision, pool));
}
Modified: subversion/branches/remove-log-addressing/subversion/svnfsfs/svnfsfs.h
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/svnfsfs/svnfsfs.h?rev=1623976&r1=1623975&r2=1623976&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/svnfsfs/svnfsfs.h (original)
+++ subversion/branches/remove-log-addressing/subversion/svnfsfs/svnfsfs.h Wed Sep 10 12:10:13 2014
@@ -54,6 +54,19 @@ svn_opt_subcommand_t
subcommand__load_index,
subcommand__stats;
+
+/* We read rev / pack files in blocks of this size.
+ * Within reason, any positive value is possible with smaller values
+ * increasing the OS chatter and larger values needlessly reading
+ * file contents we won't need. */
+#define REV_FILE_BLOCK_SIZE 0x10000
+
+/* We request P2L index information (i.e. contents descriptions) for
+ * rev / pack files blocks of this size. Within reason, any positive
+ * value is possible with smaller values increasing the cache lookup
+ * overhead. A good default is the fsfs.conf default of 1MB. */
+#define INDEX_BLOCK_SIZE 0x100000
+
/* Check that the filesystem at PATH is an FSFS repository and then open it.
* Return the filesystem in *FS, allocated in POOL. */
svn_error_t *
Modified: subversion/branches/remove-log-addressing/subversion/svnlook/svnlook.c
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/svnlook/svnlook.c?rev=1623976&r1=1623975&r2=1623976&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/svnlook/svnlook.c (original)
+++ subversion/branches/remove-log-addressing/subversion/svnlook/svnlook.c Wed Sep 10 12:10:13 2014
@@ -1706,9 +1706,14 @@ do_pget(svnlook_ctxt_t *c,
if (path == NULL)
{
/* We're operating on a revprop (e.g. c->is_revision). */
- err_msg = apr_psprintf(pool,
- _("Property '%s' not found on revision %ld"),
- propname, c->rev_id);
+ if (SVN_IS_VALID_REVNUM(c->rev_id))
+ err_msg = apr_psprintf(pool,
+ _("Property '%s' not found on revision %ld"),
+ propname, c->rev_id);
+ else
+ err_msg = apr_psprintf(pool,
+ _("Property '%s' not found on transaction %s"),
+ propname, c->txn_name);
}
else
{
Modified: subversion/branches/remove-log-addressing/subversion/tests/cmdline/basic_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/tests/cmdline/basic_tests.py?rev=1623976&r1=1623975&r2=1623976&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/tests/cmdline/basic_tests.py (original)
+++ subversion/branches/remove-log-addressing/subversion/tests/cmdline/basic_tests.py Wed Sep 10 12:10:13 2014
@@ -2003,7 +2003,6 @@ def delete_keep_local_twice(sbox):
logger.warn('Directory was really deleted')
raise svntest.Failure
-@Wimp("Fails with recent httpd", cond_func=svntest.main.is_ra_type_dav)
def special_paths_in_repos(sbox):
"use folders with names like 'c:hi'"
@@ -2011,16 +2010,21 @@ def special_paths_in_repos(sbox):
test_file_source = os.path.join(sbox.repo_dir, 'format')
repo_url = sbox.repo_url
- for test_url in [ sbox.repo_url + '/c:hi',
- sbox.repo_url + '/C:',
- sbox.repo_url + '/C&',
- sbox.repo_url + '/C<',
- sbox.repo_url + '/C# hi',
- sbox.repo_url + '/C\\ri',
- sbox.repo_url + '/C?',
- sbox.repo_url + '/C+',
- sbox.repo_url + '/C%']:
+ test_urls = [ sbox.repo_url + '/c:hi',
+ sbox.repo_url + '/C:',
+ sbox.repo_url + '/C&',
+ sbox.repo_url + '/C<',
+ sbox.repo_url + '/C# hi',
+ sbox.repo_url + '/C?',
+ sbox.repo_url + '/C+',
+ sbox.repo_url + '/C%']
+
+ # On Windows Apache HTTPD breaks '\' for us :(
+ if not (svntest.main.is_os_windows() and
+ svntest.main.is_ra_type_dav()):
+ test_urls += [ sbox.repo_url + '/C\\ri' ]
+ for test_url in test_urls:
test_file_url = test_url + '/' + test_url[test_url.rindex('/')+1:]
# do some manipulations on a folder which problematic names
Modified: subversion/branches/remove-log-addressing/subversion/tests/cmdline/lock_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/tests/cmdline/lock_tests.py?rev=1623976&r1=1623975&r2=1623976&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/tests/cmdline/lock_tests.py (original)
+++ subversion/branches/remove-log-addressing/subversion/tests/cmdline/lock_tests.py Wed Sep 10 12:10:13 2014
@@ -1964,7 +1964,6 @@ def lock_hook_messages(sbox):
expected_err, actual_stderr)
-@XFail(svntest.main.is_ra_type_dav)
def failing_post_hooks(sbox):
"locking with failing post-lock and post-unlock"
@@ -1978,20 +1977,25 @@ def failing_post_hooks(sbox):
pi_path = sbox.ospath('A/D/G/pi')
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('A/D/G/pi', writelocked='K')
- expected_fail_err_re = ".*error text"
-
+
+ if svntest.main.is_ra_type_dav():
+ expected_lock_err = []
+ expected_unlock_err = '.*svn: E165009: Unlock succeeded.*' #
+ else:
+ expected_unlock_err = expected_lock_err = ".*error text"
+
# Failing post-lock doesn't stop lock being created.
- svntest.actions.run_and_verify_svn2(None, "'pi' locked by user",
- expected_fail_err_re, 1,
- 'lock', '-m', '', pi_path)
+ svntest.actions.run_and_verify_svn(None, "'pi' locked by user",
+ expected_lock_err,
+ 'lock', '-m', '', pi_path)
svntest.actions.run_and_verify_status(wc_dir, expected_status)
expected_status.tweak('A/D/G/pi', writelocked=None)
# Failing post-unlock doesn't stop lock being removed.
- svntest.actions.run_and_verify_svn2(None, "'pi' unlocked",
- expected_fail_err_re, 1,
- 'unlock', pi_path)
+ svntest.actions.run_and_verify_svn(None, "'pi' unlocked",
+ expected_unlock_err,
+ 'unlock', pi_path)
svntest.actions.run_and_verify_status(wc_dir, expected_status)
@XFail()
Modified: subversion/branches/remove-log-addressing/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c?rev=1623976&r1=1623975&r2=1623976&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c (original)
+++ subversion/branches/remove-log-addressing/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c Wed Sep 10 12:10:13 2014
@@ -1,4 +1,4 @@
-/* fs-pack-test.c --- tests for the filesystem
+/* fs-fs-pack-test.c --- tests for the FSFS filesystem
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
@@ -1149,6 +1149,94 @@ revprop_caching_on_off(const svn_test_op
#undef REPO_NAME
/* ------------------------------------------------------------------------ */
+
+static svn_error_t *
+id_parser_test(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ #define LONG_MAX_STR #LONG_MAX
+
+ /* Verify the revision number parser (e.g. first element of a txn ID) */
+ svn_fs_fs__id_part_t id_part;
+ SVN_ERR(svn_fs_fs__id_txn_parse(&id_part, "0-0"));
+
+#if LONG_MAX == 2147483647L
+ SVN_ERR(svn_fs_fs__id_txn_parse(&id_part, "2147483647-0"));
+
+ /* Trigger all sorts of overflow conditions. */
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part, "2147483648-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part, "21474836470-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part, "21474836479-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part, "4294967295-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part, "4294967296-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part, "4294967304-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part, "4294967305-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part, "42949672950-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part, "42949672959-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+
+ /* 0x120000000 = 4831838208.
+ * 483183820 < 10*483183820 mod 2^32 = 536870904 */
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part, "4831838208-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+#else
+ SVN_ERR(svn_fs_fs__id_txn_parse(&id_part, "9223372036854775807-0"));
+
+ /* Trigger all sorts of overflow conditions. */
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part,
+ "9223372036854775808-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part,
+ "92233720368547758070-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part,
+ "92233720368547758079-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part,
+ "18446744073709551615-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part,
+ "18446744073709551616-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part,
+ "18446744073709551624-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part,
+ "18446744073709551625-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part,
+ "184467440737095516150-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part,
+ "184467440737095516159-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+
+ /* 0x12000000000000000 = 20752587082923245568.
+ * 2075258708292324556 < 10*2075258708292324556 mod 2^32 = 2305843009213693944 */
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part,
+ "20752587082923245568-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+#endif
+
+ /* Invalid characters */
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part, "2e4-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+ SVN_TEST_ASSERT_ERROR(svn_fs_fs__id_txn_parse(&id_part, "2-4-0"),
+ SVN_ERR_FS_MALFORMED_TXN_ID);
+
+ return SVN_NO_ERROR;
+}
+
+#undef REPO_NAME
+
/* The test table. */
@@ -1187,6 +1275,8 @@ static struct svn_test_descriptor_t test
"upgrade txns started before svnadmin upgrade"),
SVN_TEST_OPTS_PASS(revprop_caching_on_off,
"change revprops with enabled and disabled caching"),
+ SVN_TEST_OPTS_PASS(id_parser_test,
+ "id parser test"),
SVN_TEST_NULL
};
Propchange: subversion/branches/remove-log-addressing/subversion/tests/libsvn_fs_x/
------------------------------------------------------------------------------
Merged /subversion/trunk/subversion/tests/libsvn_fs_x:r1617439-1623968
Modified: subversion/branches/remove-log-addressing/subversion/tests/libsvn_fs_x/fs-x-pack-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/remove-log-addressing/subversion/tests/libsvn_fs_x/fs-x-pack-test.c?rev=1623976&r1=1623975&r2=1623976&view=diff
==============================================================================
--- subversion/branches/remove-log-addressing/subversion/tests/libsvn_fs_x/fs-x-pack-test.c (original)
+++ subversion/branches/remove-log-addressing/subversion/tests/libsvn_fs_x/fs-x-pack-test.c Wed Sep 10 12:10:13 2014
@@ -1,4 +1,4 @@
-/* fs-pack-test.c --- tests for the filesystem
+/* fs-x-pack-test.c --- tests for the FSX filesystem
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
Propchange: subversion/branches/remove-log-addressing/subversion/tests/libsvn_subr/bit-array-test.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: subversion/branches/remove-log-addressing/subversion/tests/manual/README
------------------------------------------------------------------------------
svn:eol-style = native