Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_diff/diff_tree.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_diff/diff_tree.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_diff/diff_tree.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_diff/diff_tree.c Fri Dec 6 13:59:05 2024 @@ -27,11 +27,7 @@ #include <assert.h> -#include "svn_dirent_uri.h" #include "svn_error.h" -#include "svn_io.h" -#include "svn_pools.h" -#include "svn_props.h" #include "svn_types.h" #include "private/svn_diff_tree.h" @@ -228,1425 +224,6 @@ svn_diff__tree_processor_create(void *ba return tp; } -struct reverse_tree_baton_t -{ - const svn_diff_tree_processor_t *processor; -}; - -static svn_error_t * -reverse_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 reverse_tree_baton_t *rb = processor->baton; - - SVN_ERR(rb->processor->dir_opened(new_dir_baton, skip, skip_children, - relpath, - right_source, left_source, - NULL /* copyfrom */, - parent_dir_baton, - rb->processor, - result_pool, scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -reverse_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 reverse_tree_baton_t *rb = processor->baton; - - SVN_ERR(rb->processor->dir_deleted(relpath, - right_source, - right_props, - dir_baton, - rb->processor, - scratch_pool)); - - return SVN_NO_ERROR; -} - -static svn_error_t * -reverse_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 reverse_tree_baton_t *rb = processor->baton; - - SVN_ERR(rb->processor->dir_added(relpath, - NULL, - left_source, - NULL, - left_props, - dir_baton, - rb->processor, - scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -reverse_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 reverse_tree_baton_t *rb = processor->baton; - apr_array_header_t *reversed_prop_changes = NULL; - - if (prop_changes) - { - SVN_ERR_ASSERT(left_props != NULL && right_props != NULL); - SVN_ERR(svn_prop_diffs(&reversed_prop_changes, left_props, right_props, - scratch_pool)); - } - - SVN_ERR(rb->processor->dir_changed(relpath, - right_source, - left_source, - right_props, - left_props, - reversed_prop_changes, - dir_baton, - rb->processor, - scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -reverse_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 reverse_tree_baton_t *rb = processor->baton; - - SVN_ERR(rb->processor->dir_closed(relpath, - right_source, - left_source, - dir_baton, - rb->processor, - scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -reverse_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 reverse_tree_baton_t *rb = processor->baton; - - SVN_ERR(rb->processor->file_opened(new_file_baton, - skip, - relpath, - right_source, - left_source, - NULL /* copy_from */, - dir_baton, - rb->processor, - result_pool, - scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -reverse_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 reverse_tree_baton_t *rb = processor->baton; - - SVN_ERR(rb->processor->file_deleted(relpath, - right_source, - right_file, - right_props, - file_baton, - rb->processor, - scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -reverse_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 reverse_tree_baton_t *rb = processor->baton; - - SVN_ERR(rb->processor->file_added(relpath, - NULL /* copyfrom src */, - left_source, - NULL /* copyfrom file */, - left_file, - NULL /* copyfrom props */, - left_props, - file_baton, - rb->processor, - scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -reverse_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 reverse_tree_baton_t *rb = processor->baton; - apr_array_header_t *reversed_prop_changes = NULL; - - if (prop_changes) - { - SVN_ERR_ASSERT(left_props != NULL && right_props != NULL); - SVN_ERR(svn_prop_diffs(&reversed_prop_changes, left_props, right_props, - scratch_pool)); - } - - SVN_ERR(rb->processor->file_changed(relpath, - right_source, - left_source, - right_file, - left_file, - right_props, - left_props, - file_modified, - reversed_prop_changes, - file_baton, - rb->processor, - scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -reverse_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 reverse_tree_baton_t *rb = processor->baton; - - SVN_ERR(rb->processor->file_closed(relpath, - right_source, - left_source, - file_baton, - rb->processor, - scratch_pool)); - - return SVN_NO_ERROR; -} - -static svn_error_t * -reverse_node_absent(const char *relpath, - void *dir_baton, - const svn_diff_tree_processor_t *processor, - apr_pool_t *scratch_pool) -{ - struct reverse_tree_baton_t *rb = processor->baton; - - SVN_ERR(rb->processor->node_absent(relpath, - dir_baton, - rb->processor, - scratch_pool)); - return SVN_NO_ERROR; -} - - -const svn_diff_tree_processor_t * -svn_diff__tree_processor_reverse_create(const svn_diff_tree_processor_t * processor, - apr_pool_t *result_pool) -{ - struct reverse_tree_baton_t *rb; - svn_diff_tree_processor_t *reverse; - - rb = apr_pcalloc(result_pool, sizeof(*rb)); - rb->processor = processor; - - reverse = svn_diff__tree_processor_create(rb, result_pool); - - reverse->dir_opened = reverse_dir_opened; - reverse->dir_added = reverse_dir_added; - reverse->dir_deleted = reverse_dir_deleted; - reverse->dir_changed = reverse_dir_changed; - reverse->dir_closed = reverse_dir_closed; - - reverse->file_opened = reverse_file_opened; - reverse->file_added = reverse_file_added; - reverse->file_deleted = reverse_file_deleted; - reverse->file_changed = reverse_file_changed; - reverse->file_closed = reverse_file_closed; - - reverse->node_absent = reverse_node_absent; - - return reverse; -} - -struct filter_tree_baton_t -{ - const svn_diff_tree_processor_t *processor; - const char *prefix_relpath; -}; - -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; - - relpath = svn_relpath_skip_ancestor(fb->prefix_relpath, relpath); - - if (! relpath) - { - /* Skip work for this, but NOT for DESCENDANTS */ - *skip = TRUE; - return SVN_NO_ERROR; - } - - 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; - - relpath = svn_relpath_skip_ancestor(fb->prefix_relpath, relpath); - assert(relpath != NULL); /* Driver error */ - - SVN_ERR(fb->processor->dir_added(relpath, - copyfrom_source, - right_source, - copyfrom_props, - right_props, - 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; - - relpath = svn_relpath_skip_ancestor(fb->prefix_relpath, relpath); - assert(relpath != NULL); /* Driver error */ - - SVN_ERR(fb->processor->dir_deleted(relpath, - left_source, - left_props, - 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; - - relpath = svn_relpath_skip_ancestor(fb->prefix_relpath, relpath); - assert(relpath != NULL); /* Driver error */ - - SVN_ERR(fb->processor->dir_changed(relpath, - left_source, - right_source, - left_props, - right_props, - prop_changes, - 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; - - relpath = svn_relpath_skip_ancestor(fb->prefix_relpath, relpath); - assert(relpath != NULL); /* Driver error */ - - 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; - - relpath = svn_relpath_skip_ancestor(fb->prefix_relpath, relpath); - - if (! relpath) - { - *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; - - relpath = svn_relpath_skip_ancestor(fb->prefix_relpath, relpath); - assert(relpath != NULL); /* Driver error */ - - 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; - - relpath = svn_relpath_skip_ancestor(fb->prefix_relpath, relpath); - assert(relpath != NULL); /* Driver error */ - - 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; - - relpath = svn_relpath_skip_ancestor(fb->prefix_relpath, relpath); - assert(relpath != NULL); /* Driver error */ - - 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; - - relpath = svn_relpath_skip_ancestor(fb->prefix_relpath, relpath); - assert(relpath != NULL); /* Driver error */ - - 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; - - relpath = svn_relpath_skip_ancestor(fb->prefix_relpath, relpath); - assert(relpath != NULL); /* Driver error */ - - SVN_ERR(fb->processor->node_absent(relpath, - dir_baton, - fb->processor, - scratch_pool)); - return SVN_NO_ERROR; -} - - -const svn_diff_tree_processor_t * -svn_diff__tree_processor_filter_create(const svn_diff_tree_processor_t * processor, - const char *prefix_relpath, - apr_pool_t *result_pool) -{ - struct filter_tree_baton_t *fb; - svn_diff_tree_processor_t *filter; - - fb = apr_pcalloc(result_pool, sizeof(*fb)); - fb->processor = processor; - if (prefix_relpath) - fb->prefix_relpath = apr_pstrdup(result_pool, prefix_relpath); - - 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; -} - -struct copy_as_changed_baton_t -{ - const svn_diff_tree_processor_t *processor; -}; - -static svn_error_t * -copy_as_changed_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 copy_as_changed_baton_t *cb = processor->baton; - - if (!left_source && copyfrom_source) - { - assert(right_source != NULL); - - left_source = copyfrom_source; - copyfrom_source = NULL; - } - - SVN_ERR(cb->processor->dir_opened(new_dir_baton, skip, skip_children, - relpath, - left_source, right_source, - copyfrom_source, - parent_dir_baton, - cb->processor, - result_pool, scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -copy_as_changed_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 copy_as_changed_baton_t *cb = processor->baton; - - if (copyfrom_source) - { - apr_array_header_t *propchanges; - SVN_ERR(svn_prop_diffs(&propchanges, right_props, copyfrom_props, - scratch_pool)); - SVN_ERR(cb->processor->dir_changed(relpath, - copyfrom_source, - right_source, - copyfrom_props, - right_props, - propchanges, - dir_baton, - cb->processor, - scratch_pool)); - } - else - { - SVN_ERR(cb->processor->dir_added(relpath, - copyfrom_source, - right_source, - copyfrom_props, - right_props, - dir_baton, - cb->processor, - scratch_pool)); - } - - return SVN_NO_ERROR; -} - -static svn_error_t * -copy_as_changed_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 copy_as_changed_baton_t *cb = processor->baton; - - SVN_ERR(cb->processor->dir_deleted(relpath, - left_source, - left_props, - dir_baton, - cb->processor, - scratch_pool)); - - return SVN_NO_ERROR; -} - -static svn_error_t * -copy_as_changed_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 copy_as_changed_baton_t *cb = processor->baton; - - SVN_ERR(cb->processor->dir_changed(relpath, - left_source, - right_source, - left_props, - right_props, - prop_changes, - dir_baton, - cb->processor, - scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -copy_as_changed_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 copy_as_changed_baton_t *cb = processor->baton; - - SVN_ERR(cb->processor->dir_closed(relpath, - left_source, - right_source, - dir_baton, - cb->processor, - scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -copy_as_changed_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 copy_as_changed_baton_t *cb = processor->baton; - - if (!left_source && copyfrom_source) - { - assert(right_source != NULL); - - left_source = copyfrom_source; - copyfrom_source = NULL; - } - - SVN_ERR(cb->processor->file_opened(new_file_baton, - skip, - relpath, - left_source, - right_source, - copyfrom_source, - dir_baton, - cb->processor, - result_pool, - scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -copy_as_changed_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 copy_as_changed_baton_t *cb = processor->baton; - - if (copyfrom_source) - { - apr_array_header_t *propchanges; - svn_boolean_t same; - SVN_ERR(svn_prop_diffs(&propchanges, right_props, copyfrom_props, - scratch_pool)); - - /* "" is sometimes a marker for just modified (E.g. no-textdeltas), - and it is certainly not a file */ - if (*copyfrom_file && *right_file) - { - SVN_ERR(svn_io_files_contents_same_p(&same, copyfrom_file, - right_file, scratch_pool)); - } - else - same = FALSE; - - SVN_ERR(cb->processor->file_changed(relpath, - copyfrom_source, - right_source, - copyfrom_file, - right_file, - copyfrom_props, - right_props, - !same, - propchanges, - file_baton, - cb->processor, - scratch_pool)); - } - else - { - SVN_ERR(cb->processor->file_added(relpath, - copyfrom_source, - right_source, - copyfrom_file, - right_file, - copyfrom_props, - right_props, - file_baton, - cb->processor, - scratch_pool)); - } - return SVN_NO_ERROR; -} - -static svn_error_t * -copy_as_changed_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 copy_as_changed_baton_t *cb = processor->baton; - - SVN_ERR(cb->processor->file_deleted(relpath, - left_source, - left_file, - left_props, - file_baton, - cb->processor, - scratch_pool)); - - return SVN_NO_ERROR; -} - -static svn_error_t * -copy_as_changed_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 copy_as_changed_baton_t *cb = processor->baton; - - SVN_ERR(cb->processor->file_changed(relpath, - left_source, - right_source, - left_file, - right_file, - left_props, - right_props, - file_modified, - prop_changes, - file_baton, - cb->processor, - scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -copy_as_changed_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 copy_as_changed_baton_t *cb = processor->baton; - - SVN_ERR(cb->processor->file_closed(relpath, - left_source, - right_source, - file_baton, - cb->processor, - scratch_pool)); - - return SVN_NO_ERROR; -} - -static svn_error_t * -copy_as_changed_node_absent(const char *relpath, - void *dir_baton, - const svn_diff_tree_processor_t *processor, - apr_pool_t *scratch_pool) -{ - struct copy_as_changed_baton_t *cb = processor->baton; - - SVN_ERR(cb->processor->node_absent(relpath, - dir_baton, - cb->processor, - scratch_pool)); - return SVN_NO_ERROR; -} - - -const svn_diff_tree_processor_t * -svn_diff__tree_processor_copy_as_changed_create( - const svn_diff_tree_processor_t * processor, - apr_pool_t *result_pool) -{ - struct copy_as_changed_baton_t *cb; - svn_diff_tree_processor_t *filter; - - cb = apr_pcalloc(result_pool, sizeof(*cb)); - cb->processor = processor; - - filter = svn_diff__tree_processor_create(cb, result_pool); - filter->dir_opened = copy_as_changed_dir_opened; - filter->dir_added = copy_as_changed_dir_added; - filter->dir_deleted = copy_as_changed_dir_deleted; - filter->dir_changed = copy_as_changed_dir_changed; - filter->dir_closed = copy_as_changed_dir_closed; - - filter->file_opened = copy_as_changed_file_opened; - filter->file_added = copy_as_changed_file_added; - filter->file_deleted = copy_as_changed_file_deleted; - filter->file_changed = copy_as_changed_file_changed; - filter->file_closed = copy_as_changed_file_closed; - - filter->node_absent = copy_as_changed_node_absent; - - return filter; -} - - -/* Processor baton for the tee tree processor */ -struct tee_baton_t -{ - const svn_diff_tree_processor_t *p1; - const svn_diff_tree_processor_t *p2; -}; - -/* Wrapper baton for file and directory batons in the tee processor */ -struct tee_node_baton_t -{ - void *baton1; - void *baton2; -}; - -static svn_error_t * -tee_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 tee_baton_t *tb = processor->baton; - struct tee_node_baton_t *pb = parent_dir_baton; - struct tee_node_baton_t *nb = apr_pcalloc(result_pool, sizeof(*nb)); - - SVN_ERR(tb->p1->dir_opened(&(nb->baton1), - skip, - skip_children, - relpath, - left_source, - right_source, - copyfrom_source, - pb ? pb->baton1 : NULL, - tb->p1, - result_pool, - scratch_pool)); - - SVN_ERR(tb->p2->dir_opened(&(nb->baton2), - skip, - skip_children, - relpath, - left_source, - right_source, - copyfrom_source, - pb ? pb->baton2 : NULL, - tb->p2, - result_pool, - scratch_pool)); - - *new_dir_baton = nb; - - return SVN_NO_ERROR; -} - -static svn_error_t * -tee_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 tee_baton_t *tb = processor->baton; - struct tee_node_baton_t *db = dir_baton; - - SVN_ERR(tb->p1->dir_added(relpath, - copyfrom_source, - right_source, - copyfrom_props, - right_props, - db->baton1, - tb->p1, - scratch_pool)); - - SVN_ERR(tb->p2->dir_added(relpath, - copyfrom_source, - right_source, - copyfrom_props, - right_props, - db->baton2, - tb->p2, - scratch_pool)); - - return SVN_NO_ERROR; -} - -static svn_error_t * -tee_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 tee_baton_t *tb = processor->baton; - struct tee_node_baton_t *db = dir_baton; - - SVN_ERR(tb->p1->dir_deleted(relpath, - left_source, - left_props, - db->baton1, - tb->p1, - scratch_pool)); - - SVN_ERR(tb->p2->dir_deleted(relpath, - left_source, - left_props, - db->baton2, - tb->p2, - scratch_pool)); - - return SVN_NO_ERROR; -} - -static svn_error_t * -tee_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 tee_baton_t *tb = processor->baton; - struct tee_node_baton_t *db = dir_baton; - - SVN_ERR(tb->p1->dir_changed(relpath, - left_source, - right_source, - left_props, - right_props, - prop_changes, - db->baton1, - tb->p1, - scratch_pool)); - - SVN_ERR(tb->p2->dir_changed(relpath, - left_source, - right_source, - left_props, - right_props, - prop_changes, - db->baton2, - tb->p2, - scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -tee_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 tee_baton_t *tb = processor->baton; - struct tee_node_baton_t *db = dir_baton; - - SVN_ERR(tb->p1->dir_closed(relpath, - left_source, - right_source, - db->baton1, - tb->p1, - scratch_pool)); - - SVN_ERR(tb->p2->dir_closed(relpath, - left_source, - right_source, - db->baton2, - tb->p2, - scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -tee_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 tee_baton_t *tb = processor->baton; - struct tee_node_baton_t *pb = dir_baton; - struct tee_node_baton_t *nb = apr_pcalloc(result_pool, sizeof(*nb)); - - SVN_ERR(tb->p1->file_opened(&(nb->baton1), - skip, - relpath, - left_source, - right_source, - copyfrom_source, - pb ? pb->baton1 : NULL, - tb->p1, - result_pool, - scratch_pool)); - - SVN_ERR(tb->p2->file_opened(&(nb->baton2), - skip, - relpath, - left_source, - right_source, - copyfrom_source, - pb ? pb->baton2 : NULL, - tb->p2, - result_pool, - scratch_pool)); - - *new_file_baton = nb; - - return SVN_NO_ERROR; -} - -static svn_error_t * -tee_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 tee_baton_t *tb = processor->baton; - struct tee_node_baton_t *fb = file_baton; - - SVN_ERR(tb->p1->file_added(relpath, - copyfrom_source, - right_source, - copyfrom_file, - right_file, - copyfrom_props, - right_props, - fb->baton1, - tb->p1, - scratch_pool)); - - SVN_ERR(tb->p2->file_added(relpath, - copyfrom_source, - right_source, - copyfrom_file, - right_file, - copyfrom_props, - right_props, - fb->baton2, - tb->p2, - scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -tee_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 tee_baton_t *tb = processor->baton; - struct tee_node_baton_t *fb = file_baton; - - SVN_ERR(tb->p1->file_deleted(relpath, - left_source, - left_file, - left_props, - fb->baton1, - tb->p1, - scratch_pool)); - - SVN_ERR(tb->p2->file_deleted(relpath, - left_source, - left_file, - left_props, - fb->baton2, - tb->p2, - scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -tee_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 tee_baton_t *tb = processor->baton; - struct tee_node_baton_t *fb = file_baton; - - SVN_ERR(tb->p1->file_changed(relpath, - left_source, - right_source, - left_file, - right_file, - left_props, - right_props, - file_modified, - prop_changes, - fb->baton1, - tb->p1, - scratch_pool)); - - SVN_ERR(tb->p2->file_changed(relpath, - left_source, - right_source, - left_file, - right_file, - left_props, - right_props, - file_modified, - prop_changes, - fb->baton2, - tb->p2, - scratch_pool)); - return SVN_NO_ERROR; -} - -static svn_error_t * -tee_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 tee_baton_t *tb = processor->baton; - struct tee_node_baton_t *fb = file_baton; - - SVN_ERR(tb->p1->file_closed(relpath, - left_source, - right_source, - fb->baton1, - tb->p1, - scratch_pool)); - - SVN_ERR(tb->p2->file_closed(relpath, - left_source, - right_source, - fb->baton2, - tb->p2, - scratch_pool)); - - return SVN_NO_ERROR; -} - -static svn_error_t * -tee_node_absent(const char *relpath, - void *dir_baton, - const svn_diff_tree_processor_t *processor, - apr_pool_t *scratch_pool) -{ - struct tee_baton_t *tb = processor->baton; - struct tee_node_baton_t *db = dir_baton; - - SVN_ERR(tb->p1->node_absent(relpath, - db ? db->baton1 : NULL, - tb->p1, - scratch_pool)); - - SVN_ERR(tb->p2->node_absent(relpath, - db ? db->baton2 : NULL, - tb->p2, - scratch_pool)); - - return SVN_NO_ERROR; -} - -const svn_diff_tree_processor_t * -svn_diff__tree_processor_tee_create(const svn_diff_tree_processor_t *processor1, - const svn_diff_tree_processor_t *processor2, - apr_pool_t *result_pool) -{ - struct tee_baton_t *tb = apr_pcalloc(result_pool, sizeof(*tb)); - svn_diff_tree_processor_t *tee; - tb->p1 = processor1; - tb->p2 = processor2; - - tee = svn_diff__tree_processor_create(tb, result_pool); - - tee->dir_opened = tee_dir_opened; - tee->dir_added = tee_dir_added; - tee->dir_deleted = tee_dir_deleted; - tee->dir_changed = tee_dir_changed; - tee->dir_closed = tee_dir_closed; - tee->file_opened = tee_file_opened; - tee->file_added = tee_file_added; - tee->file_deleted = tee_file_deleted; - tee->file_changed = tee_file_changed; - tee->file_closed = tee_file_closed; - tee->node_absent = tee_node_absent; - - return tee; -} - svn_diff_source_t * svn_diff__source_create(svn_revnum_t revision, apr_pool_t *result_pool)
Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_fs/fs-loader.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_fs/fs-loader.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_fs/fs-loader.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_fs/fs-loader.c Fri Dec 6 13:59:05 2024 @@ -52,6 +52,18 @@ #include "fs-loader.h" +/* Here are the declarations for the FS module init functions. If we + are using DSO loading, they won't actually be linked into + libsvn_fs. Note that these private functions have a common_pool + parameter that may be used for fs module scoped variables such as + the bdb cache. This will be the same common_pool that is passed + to the create and open functions and these init functions (as well + as the open and create functions) are globally serialized so that + they have exclusive access to the common_pool. */ +#include "../libsvn_fs_base/fs_init.h" +#include "../libsvn_fs_fs/fs_init.h" +#include "../libsvn_fs_x/fs_init.h" + /* This is defined by configure on platforms which use configure, but we need to define a fallback for Windows. */ #ifndef DEFAULT_FS_TYPE Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_fs/fs-loader.h URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_fs/fs-loader.h?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_fs/fs-loader.h (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_fs/fs-loader.h Fri Dec 6 13:59:05 2024 @@ -183,18 +183,6 @@ typedef svn_error_t *(*fs_init_func_t)(c fs_library_vtable_t **vtable, apr_pool_t* common_pool); -/* Here are the declarations for the FS module init functions. If we - are using DSO loading, they won't actually be linked into - libsvn_fs. Note that these private functions have a common_pool - parameter that may be used for fs module scoped variables such as - the bdb cache. This will be the same common_pool that is passed - to the create and open functions and these init functions (as well - as the open and create functions) are globally serialized so that - they have exclusive access to the common_pool. */ -#include "../libsvn_fs_base/fs_init.h" -#include "../libsvn_fs_fs/fs_init.h" -#include "../libsvn_fs_x/fs_init.h" - /*** vtable types for the abstract FS objects ***/ Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_base/fs.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_base/fs.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_base/fs.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_base/fs.c Fri Dec 6 13:59:05 2024 @@ -36,6 +36,7 @@ #include "svn_delta.h" #include "svn_version.h" #include "fs.h" +#include "fs_init.h" #include "err.h" #include "dag.h" #include "revs-txns.h" Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_base/fs_init.h URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_base/fs_init.h?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_base/fs_init.h (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_base/fs_init.h Fri Dec 6 13:59:05 2024 @@ -22,9 +22,10 @@ * ==================================================================== */ -#ifndef LIBSVN_FS_LOADER_H -#error Please include libsvn_fs/fs_loader.h instead of this file -#else +#ifndef SVN_LIBSVN_FS_BASE_INIT +#define SVN_LIBSVN_FS_BASE_INIT + +#include "../libsvn_fs/fs-loader.h" svn_error_t *svn_fs_base__init(const svn_version_t *loader_version, fs_library_vtable_t **vtable, Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_fs/fs.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_fs/fs.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_fs/fs.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_fs/fs.c Fri Dec 6 13:59:05 2024 @@ -34,6 +34,7 @@ #include "svn_pools.h" #include "fs.h" #include "fs_fs.h" +#include "fs_init.h" #include "tree.h" #include "lock.h" #include "hotcopy.h" Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_fs/fs_init.h URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_fs/fs_init.h?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_fs/fs_init.h (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_fs/fs_init.h Fri Dec 6 13:59:05 2024 @@ -21,12 +21,13 @@ * ==================================================================== */ -#ifndef LIBSVN_FS_LOADER_H -#error Please include libsvn_fs/fs_loader.h instead of this file -#else +#ifndef SVN_LIBSVN_FS_FS_INIT +#define SVN_LIBSVN_FS_FS_INIT + +#include "../libsvn_fs/fs-loader.h" svn_error_t *svn_fs_fs__init(const svn_version_t *loader_version, - fs_library_vtable_t **vtable, - apr_pool_t* common_pool); + fs_library_vtable_t **vtable, + apr_pool_t *common_pool); #endif Propchange: subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_x/ ------------------------------------------------------------------------------ Merged /subversion/branches/windows-shared-ra-modules/subversion/libsvn_fs_x:r1920808-1921005 Merged /subversion/trunk/subversion/libsvn_fs_x:r1908636-1922344 Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_x/fs.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_x/fs.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_x/fs.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_x/fs.c Fri Dec 6 13:59:05 2024 @@ -35,6 +35,7 @@ #include "batch_fsync.h" #include "fs.h" #include "fs_x.h" +#include "fs_init.h" #include "pack.h" #include "recovery.h" #include "hotcopy.h" Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_x/fs_init.h URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_x/fs_init.h?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_x/fs_init.h (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_fs_x/fs_init.h Fri Dec 6 13:59:05 2024 @@ -21,13 +21,14 @@ * ==================================================================== */ -#ifndef LIBSVN_FS_LOADER_H -#error Please include libsvn_fs/fs_loader.h instead of this file -#else +#ifndef SVN_LIBSVN_FS_X_INIT +#define SVN_LIBSVN_FS_X_INIT + +#include "../libsvn_fs/fs-loader.h" svn_error_t *svn_fs_x__init(const svn_version_t *loader_version, - fs_library_vtable_t **vtable, - apr_pool_t* common_pool); + fs_library_vtable_t **vtable, + apr_pool_t *common_pool); #endif Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_ra/deprecated.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_ra/deprecated.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_ra/deprecated.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_ra/deprecated.c Fri Dec 6 13:59:05 2024 @@ -34,7 +34,11 @@ #include "svn_pools.h" #include "ra_loader.h" -#include "deprecated.h" + +/* Declarations of the init functions for the available RA libraries. */ +#include "../libsvn_ra_local/ra_init.h" +#include "../libsvn_ra_svn/ra_init.h" +#include "../libsvn_ra_serf/ra_init.h" #include "svn_private_config.h" @@ -497,26 +501,52 @@ svn_error_t *svn_ra_get_dir(svn_ra_sessi path, revision, SVN_DIRENT_ALL, pool); } +/* For each libsvn_ra_foo library, provide an implementation of deprecated + svn_ra_foo_init function that wraps svn_ra_foo__compat_init, or returns + a "not implemented" error if it was not linked. */ + +#ifndef SVN_LIBSVN_RA_LINKS_RA_NEON svn_error_t * -svn_ra_local__deprecated_init(int abi_version, - apr_pool_t *pool, - apr_hash_t *hash) +svn_ra_dav_init(int abi_version, + apr_pool_t *pool, + apr_hash_t *hash) { - return svn_error_trace(svn_ra_local_init(abi_version, pool, hash)); + return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL); } +#endif /* ! SVN_LIBSVN_RA_LINKS_RA_NEON */ svn_error_t * -svn_ra_svn__deprecated_init(int abi_version, - apr_pool_t *pool, - apr_hash_t *hash) -{ - return svn_error_trace(svn_ra_svn_init(abi_version, pool, hash)); +svn_ra_svn_init(int abi_version, + apr_pool_t *pool, + apr_hash_t *hash) +{ +#ifdef SVN_LIBSVN_RA_LINKS_RA_SVN + return svn_error_trace(svn_ra_svn__compat_init(abi_version, pool, hash)); +#else + return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL); +#endif /* ! SVN_LIBSVN_RA_LINKS_RA_SVN */ } svn_error_t * -svn_ra_serf__deprecated_init(int abi_version, - apr_pool_t *pool, - apr_hash_t *hash) -{ - return svn_error_trace(svn_ra_serf_init(abi_version, pool, hash)); +svn_ra_local_init(int abi_version, + apr_pool_t *pool, + apr_hash_t *hash) +{ +#ifdef SVN_LIBSVN_RA_LINKS_RA_LOCAL + return svn_error_trace(svn_ra_local__compat_init(abi_version, pool, hash)); +#else + return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL); +#endif /* ! SVN_LIBSVN_RA_LINKS_RA_LOCAL */ +} + +svn_error_t * +svn_ra_serf_init(int abi_version, + apr_pool_t *pool, + apr_hash_t *hash) +{ +#ifdef SVN_LIBSVN_RA_LINKS_RA_SERF + return svn_error_trace(svn_ra_serf__compat_init(abi_version, pool, hash)); +#else + return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL); +#endif /* ! SVN_LIBSVN_RA_LINKS_RA_SERF */ } Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_ra/ra_loader.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_ra/ra_loader.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_ra/ra_loader.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_ra/ra_loader.c Fri Dec 6 13:59:05 2024 @@ -50,12 +50,15 @@ #include "svn_config.h" #include "ra_loader.h" -#include "deprecated.h" #include "private/svn_auth_private.h" #include "private/svn_ra_private.h" #include "svn_private_config.h" +/* Declarations of the init functions for the available RA libraries. */ +#include "../libsvn_ra_local/ra_init.h" +#include "../libsvn_ra_svn/ra_init.h" +#include "../libsvn_ra_serf/ra_init.h" @@ -82,7 +85,7 @@ static const struct ra_lib_defn { svn_schemes, #ifdef SVN_LIBSVN_RA_LINKS_RA_SVN svn_ra_svn__init, - svn_ra_svn__deprecated_init + svn_ra_svn__compat_init #endif }, @@ -91,7 +94,7 @@ static const struct ra_lib_defn { local_schemes, #ifdef SVN_LIBSVN_RA_LINKS_RA_LOCAL svn_ra_local__init, - svn_ra_local__deprecated_init + svn_ra_local__compat_init #endif }, @@ -100,7 +103,7 @@ static const struct ra_lib_defn { dav_schemes, #ifdef SVN_LIBSVN_RA_LINKS_RA_SERF svn_ra_serf__init, - svn_ra_serf__deprecated_init + svn_ra_serf__compat_init #endif }, @@ -1567,47 +1570,3 @@ svn_ra_get_ra_library(svn_ra_plugin_t ** return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL, _("Unrecognized URL scheme '%s'"), url); } - -/* For each libsvn_ra_foo library that is not linked in, provide a default - implementation for svn_ra_foo_init which returns a "not implemented" - error. */ - -#ifndef SVN_LIBSVN_RA_LINKS_RA_NEON -svn_error_t * -svn_ra_dav_init(int abi_version, - apr_pool_t *pool, - apr_hash_t *hash) -{ - return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL); -} -#endif /* ! SVN_LIBSVN_RA_LINKS_RA_NEON */ - -#ifndef SVN_LIBSVN_RA_LINKS_RA_SVN -svn_error_t * -svn_ra_svn_init(int abi_version, - apr_pool_t *pool, - apr_hash_t *hash) -{ - return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL); -} -#endif /* ! SVN_LIBSVN_RA_LINKS_RA_SVN */ - -#ifndef SVN_LIBSVN_RA_LINKS_RA_LOCAL -svn_error_t * -svn_ra_local_init(int abi_version, - apr_pool_t *pool, - apr_hash_t *hash) -{ - return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL); -} -#endif /* ! SVN_LIBSVN_RA_LINKS_RA_LOCAL */ - -#ifndef SVN_LIBSVN_RA_LINKS_RA_SERF -svn_error_t * -svn_ra_serf_init(int abi_version, - apr_pool_t *pool, - apr_hash_t *hash) -{ - return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL); -} -#endif /* ! SVN_LIBSVN_RA_LINKS_RA_SERF */ Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_ra/ra_loader.h URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_ra/ra_loader.h?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_ra/ra_loader.h (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_ra/ra_loader.h Fri Dec 6 13:59:05 2024 @@ -419,17 +419,6 @@ typedef svn_error_t * const svn_ra__vtable_t **vtable, apr_pool_t *pool); -/* Declarations of the init functions for the available RA libraries. */ -svn_error_t *svn_ra_local__init(const svn_version_t *loader_version, - const svn_ra__vtable_t **vtable, - apr_pool_t *pool); -svn_error_t *svn_ra_svn__init(const svn_version_t *loader_version, - const svn_ra__vtable_t **vtable, - apr_pool_t *pool); -svn_error_t *svn_ra_serf__init(const svn_version_t *loader_version, - const svn_ra__vtable_t **vtable, - apr_pool_t *pool); - /*** Compat Functions ***/ Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_local/ra_plugin.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_local/ra_plugin.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_local/ra_plugin.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_local/ra_plugin.c Fri Dec 6 13:59:05 2024 @@ -22,6 +22,7 @@ */ #include "ra_local.h" +#include "ra_init.h" #include "svn_hash.h" #include "svn_ra.h" #include "svn_fs.h" @@ -1997,5 +1998,5 @@ svn_ra_local__init(const svn_version_t * #define DESCRIPTION RA_LOCAL_DESCRIPTION #define VTBL ra_local_vtable #define INITFUNC svn_ra_local__init -#define COMPAT_INITFUNC svn_ra_local_init +#define COMPAT_INITFUNC svn_ra_local__compat_init #include "../libsvn_ra/wrapper_template.h" Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_serf/inherited_props.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_serf/inherited_props.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_serf/inherited_props.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_serf/inherited_props.c Fri Dec 6 13:59:05 2024 @@ -23,7 +23,6 @@ #include <apr_tables.h> -#include <apr_xml.h> #include "svn_hash.h" #include "svn_path.h" Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_serf/mergeinfo.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_serf/mergeinfo.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_serf/mergeinfo.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_serf/mergeinfo.c Fri Dec 6 13:59:05 2024 @@ -22,7 +22,6 @@ */ #include <apr_tables.h> -#include <apr_xml.h> #include "svn_hash.h" #include "svn_mergeinfo.h" Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_serf/serf.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_serf/serf.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_serf/serf.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_serf/serf.c Fri Dec 6 13:59:05 2024 @@ -49,6 +49,7 @@ #include "private/svn_subr_private.h" #include "svn_private_config.h" +#include "ra_init.h" #include "ra_serf.h" @@ -1127,5 +1128,5 @@ svn_ra_serf__init(const svn_version_t *l #define DESCRIPTION RA_SERF_DESCRIPTION #define VTBL serf_vtable #define INITFUNC svn_ra_serf__init -#define COMPAT_INITFUNC svn_ra_serf_init +#define COMPAT_INITFUNC svn_ra_serf__compat_init #include "../libsvn_ra/wrapper_template.h" Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_svn/client.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_svn/client.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_svn/client.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_ra_svn/client.c Fri Dec 6 13:59:05 2024 @@ -56,6 +56,7 @@ #include "../libsvn_ra/ra_loader.h" +#include "ra_init.h" #include "ra_svn.h" #ifdef SVN_HAVE_SASL @@ -3372,5 +3373,5 @@ svn_ra_svn__init(const svn_version_t *lo #define DESCRIPTION RA_SVN_DESCRIPTION #define VTBL ra_svn_vtable #define INITFUNC svn_ra_svn__init -#define COMPAT_INITFUNC svn_ra_svn_init +#define COMPAT_INITFUNC svn_ra_svn__compat_init #include "../libsvn_ra/wrapper_template.h" Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_repos/load-fs-vtable.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_repos/load-fs-vtable.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_repos/load-fs-vtable.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_repos/load-fs-vtable.c Fri Dec 6 13:59:05 2024 @@ -42,6 +42,7 @@ #include "private/svn_dep_compat.h" #include "private/svn_mergeinfo_private.h" #include "private/svn_repos_private.h" +#include "private/svn_subr_private.h" /*----------------------------------------------------------------------*/ @@ -77,6 +78,8 @@ struct parse_baton contents are allocated in POOL. */ /* ### See https://issues.apache.org/jira/browse/SVN-3903 ### for discussion about improving the memory costs of this mapping. */ + /* Using svn_revnum_t as a key can interact badly with APR's default hash + see tools/dev/hash-test.c. Use svn_hash__make to get a suitable hash. */ apr_hash_t *rev_map; /* The most recent (youngest) revision from the dump stream mapped in @@ -1255,7 +1258,7 @@ svn_repos_get_fs_build_parser6(const svn pb->parent_dir = parent_dir; pb->pool = pool; pb->notify_pool = svn_pool_create(pool); - pb->rev_map = apr_hash_make(pool); + pb->rev_map = svn_hash__make(pool); pb->oldest_dumpstream_rev = SVN_INVALID_REVNUM; pb->last_rev_mapped = SVN_INVALID_REVNUM; pb->start_rev = start_rev; Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_repos/log.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_repos/log.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_repos/log.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_repos/log.c Fri Dec 6 13:59:05 2024 @@ -1719,8 +1719,8 @@ do_logs(svn_fs_t *fs, int limit, svn_boolean_t strict_node_history, svn_boolean_t include_merged_revisions, - svn_boolean_t handling_merged_revisions, svn_boolean_t subtractive_merge, + svn_boolean_t handling_merged_revisions, svn_boolean_t ignore_missing_locations, const apr_array_header_t *revprops, svn_boolean_t descending_order, Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_repos/reporter.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_repos/reporter.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_repos/reporter.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_repos/reporter.c Fri Dec 6 13:59:05 2024 @@ -138,7 +138,8 @@ typedef struct report_baton_t svn_fs_root_t *s_roots[NUM_CACHED_SOURCE_ROOTS]; /* Cache for revision properties. This is used to eliminate redundant - revprop fetching. */ + revprop fetching. svn_revnum_t keys so use svn_hash__make to get a + suitable hash function. */ apr_hash_t *revision_infos; /* This will not change. So, fetch it once and reuse it. */ @@ -1628,7 +1629,7 @@ svn_repos_begin_report3(void **report_ba b->edit_baton = edit_baton; b->authz_read_func = authz_read_func; b->authz_read_baton = authz_read_baton; - b->revision_infos = apr_hash_make(pool); + b->revision_infos = svn_hash__make(pool); b->pool = pool; b->reader = svn_spillbuf__reader_create(1000 /* blocksize */, 1000000 /* maxsize */, Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/auth.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/auth.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/auth.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/auth.c Fri Dec 6 13:59:05 2024 @@ -508,7 +508,7 @@ svn_auth_get_platform_specific_provider( const char *library_label, *library_name; const char *provider_function_name, *version_function_name; library_name = apr_psprintf(pool, - "libsvn_auth_%s-%d.so.%d", + "libsvn_auth_%s-" SVN_DSO_SUFFIX_FMT, provider_name, SVN_VER_MAJOR, SVN_SOVERSION); library_label = apr_psprintf(pool, "svn_%s", provider_name); Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/cmdline.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/cmdline.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/cmdline.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/cmdline.c Fri Dec 6 13:59:05 2024 @@ -1898,3 +1898,60 @@ svn_cmdline__cancellation_exit(void) #endif } } + +#if defined(WIN32) + +svn_error_t * +svn_cmdline__win32_get_cstring_argv(const char **cstring_argv_p[], + int argc, + const wchar_t *argv[], + apr_pool_t *result_pool) +{ + apr_array_header_t *cstring_argv; + int i; + + cstring_argv = apr_array_make(result_pool, argc + 1, sizeof(const char *)); + + for (i = 0; i < argc; i++) + { + const wchar_t *arg = argv[i]; + char *cstring_arg; + int rv; + + /* Passing -1 for the string length guarantees that the returned length + will account for a terminating null character. */ + rv = WideCharToMultiByte(CP_ACP, 0, arg, -1, NULL, 0, NULL, NULL); + if (rv <= 0) + { + return svn_error_wrap_apr(apr_get_os_error(), + _("Conversion from UTF-16 failed")); + } + + cstring_arg = apr_palloc(result_pool, rv); + rv = WideCharToMultiByte(CP_ACP, 0, arg, -1, cstring_arg, rv, NULL, NULL); + if (rv <= 0) + { + return svn_error_wrap_apr(apr_get_os_error(), + _("Conversion from UTF-16 failed")); + } + + APR_ARRAY_PUSH(cstring_argv, const char *) = cstring_arg; + } + + APR_ARRAY_PUSH(cstring_argv, const char *) = NULL; + + *cstring_argv_p = (const char **)cstring_argv->elts; + return SVN_NO_ERROR; +} + +#endif + +svn_error_t * +svn_cmdline__default_get_cstring_argv(const char **cstring_argv_p[], + int argc, + const char *argv[], + apr_pool_t *result_pool) +{ + *cstring_argv_p = argv; + return SVN_NO_ERROR; +} Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/io.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/io.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/io.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/io.c Fri Dec 6 13:59:05 2024 @@ -1899,7 +1899,7 @@ svn_io__utf8_to_unicode_longpath(const W } } - SVN_ERR(svn_utf__win32_utf8_to_utf16(&(const WCHAR*)buffer, source, + SVN_ERR(svn_utf__win32_utf8_to_utf16(&buffer, source, prefix, result_pool)); /* Convert slashes to backslashes because the \\?\ path format @@ -2531,27 +2531,14 @@ svn_io__is_finfo_read_only(svn_boolean_t apr_pool_t *pool) { #if defined(APR_HAS_USER) && !defined(WIN32) &&!defined(__OS2__) - apr_status_t apr_err; - apr_uid_t uid; - apr_gid_t gid; - - *read_only = FALSE; - - apr_err = apr_uid_current(&uid, &gid, pool); - - if (apr_err) - return svn_error_wrap_apr(apr_err, _("Error getting UID of process")); - - /* Check write bit for current user. */ - if (apr_uid_compare(uid, file_info->user) == APR_SUCCESS) - *read_only = !(file_info->protection & APR_UWRITE); - - else if (apr_gid_compare(gid, file_info->group) == APR_SUCCESS) - *read_only = !(file_info->protection & APR_GWRITE); - - else - *read_only = !(file_info->protection & APR_WWRITE); - + *read_only = (access(file_info->fname, W_OK) != 0); + /* svn_io__is_finfo_read_only can be called with a dangling + * symlink. access() will check the permission on the missing + * target and return -1 and errno = ENOENT. Check for ENOENT + * and pretend the file is writeable, otherwise we will get + * spurious Reverted messages on the symlink. + */ + if (*read_only && errno == ENOENT) *read_only = FALSE; #else /* WIN32 || __OS2__ || !APR_HAS_USER */ *read_only = (file_info->protection & APR_FREADONLY); #endif @@ -2564,33 +2551,7 @@ svn_io__is_finfo_executable(svn_boolean_ apr_finfo_t *file_info, apr_pool_t *pool) { -#if defined(APR_HAS_USER) && !defined(WIN32) &&!defined(__OS2__) - apr_status_t apr_err; - apr_uid_t uid; - apr_gid_t gid; - - *executable = FALSE; - - apr_err = apr_uid_current(&uid, &gid, pool); - - if (apr_err) - return svn_error_wrap_apr(apr_err, _("Error getting UID of process")); - - /* Check executable bit for current user. */ - if (apr_uid_compare(uid, file_info->user) == APR_SUCCESS) - *executable = (file_info->protection & APR_UEXECUTE); - - else if (apr_gid_compare(gid, file_info->group) == APR_SUCCESS) - *executable = (file_info->protection & APR_GEXECUTE); - - else - *executable = (file_info->protection & APR_WEXECUTE); - -#else /* WIN32 || __OS2__ || !APR_HAS_USER */ - *executable = FALSE; -#endif - - return SVN_NO_ERROR; + return svn_io_is_file_executable(executable, file_info->fname, pool); } svn_error_t * @@ -2599,12 +2560,7 @@ svn_io_is_file_executable(svn_boolean_t apr_pool_t *pool) { #if defined(APR_HAS_USER) && !defined(WIN32) &&!defined(__OS2__) - apr_finfo_t file_info; - - SVN_ERR(svn_io_stat(&file_info, path, APR_FINFO_PROT | APR_FINFO_OWNER, - pool)); - SVN_ERR(svn_io__is_finfo_executable(executable, &file_info, pool)); - + *executable = (access(path, X_OK) == 0); #else /* WIN32 || __OS2__ || !APR_HAS_USER */ *executable = FALSE; #endif Modified: subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/opt.c URL: http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/opt.c?rev=1922345&r1=1922344&r2=1922345&view=diff ============================================================================== --- subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/opt.c (original) +++ subversion/branches/pristine-checksum-kind/subversion/libsvn_subr/opt.c Fri Dec 6 13:59:05 2024 @@ -629,6 +629,86 @@ svn_opt_parse_revision_to_range(apr_arra return 0; } +int svn_opt_parse_change_to_range(apr_array_header_t *opt_ranges, + const char *arg, + apr_pool_t *result_pool) +{ + char *end; + svn_revnum_t changeno, changeno_end; + const char *s = arg; + svn_boolean_t is_negative; + + /* Check for a leading minus to allow "-c -r42". + * The is_negative flag is used to handle "-c -42" and "-c -r42". + * The "-c r-42" case is handled by strtol() returning a + * negative number. */ + is_negative = (*s == '-'); + if (is_negative) + s++; + + /* Allow any number of 'r's to prefix a revision number. */ + while (*s == 'r') + s++; + changeno = changeno_end = strtol(s, &end, 10); + if (end != s && *end == '-') + { + /* Negative number in range not supported with -c */ + if (changeno < 0 || is_negative) + return -1; + + s = end + 1; + while (*s == 'r') + s++; + changeno_end = strtol(s, &end, 10); + + /* Negative number in range not supported with -c */ + if (changeno_end < 0) + return -1; + } + + /* Non-numeric change argument given to -c? */ + if (end == arg || *end != '\0') + return -1; + + /* There is no change 0 */ + if (changeno == 0 || changeno_end == 0) + return -1; + + /* The revision number cannot contain a double minus */ + if (changeno < 0 && is_negative) + return -1; + + if (is_negative) + changeno = -changeno; + + /* Figure out the range: + -c N -> -r N-1:N + -c -N -> -r N:N-1 + -c M-N -> -r M-1:N for M < N + -c M-N -> -r M:N-1 for M > N + -c -M-N -> error (too confusing/no valid use case) + */ + if (changeno > 0) + { + if (changeno <= changeno_end) + changeno--; + else + changeno_end--; + } + else + { + changeno = -changeno; + changeno_end = changeno - 1; + } + + APR_ARRAY_PUSH(opt_ranges, + svn_opt_revision_range_t *) + = svn_opt__revision_range_from_revnums(changeno, changeno_end, + result_pool); + + return 0; +} + svn_error_t * svn_opt_resolve_revisions(svn_opt_revision_t *peg_rev, svn_opt_revision_t *op_rev,
