diff options
Diffstat (limited to 'subversion/libsvn_client/add.c')
-rw-r--r-- | subversion/libsvn_client/add.c | 143 |
1 files changed, 49 insertions, 94 deletions
diff --git a/subversion/libsvn_client/add.c b/subversion/libsvn_client/add.c index f121bc8..ce7891a 100644 --- a/subversion/libsvn_client/add.c +++ b/subversion/libsvn_client/add.c @@ -48,6 +48,7 @@ #include "private/svn_client_private.h" #include "private/svn_wc_private.h" #include "private/svn_ra_private.h" +#include "private/svn_sorts_private.h" #include "private/svn_magic.h" #include "svn_private_config.h" @@ -168,8 +169,8 @@ get_auto_props_for_pattern(apr_hash_t *properties, hi != NULL; hi = apr_hash_next(hi)) { - const char *propname = svn__apr_hash_index_key(hi); - const char *propval = svn__apr_hash_index_val(hi); + const char *propname = apr_hash_this_key(hi); + const char *propval = apr_hash_this_val(hi); svn_string_t *propval_str = svn_string_create_empty(apr_hash_pool_get(properties)); @@ -206,8 +207,8 @@ svn_client__get_paths_auto_props(apr_hash_t **properties, hi != NULL; hi = apr_hash_next(hi)) { - const char *pattern = svn__apr_hash_index_key(hi); - apr_hash_t *propvals = svn__apr_hash_index_val(hi); + const char *pattern = apr_hash_this_key(hi); + apr_hash_t *propvals = apr_hash_this_val(hi); get_auto_props_for_pattern(*properties, mimetype, &have_executable, svn_dirent_basename(path, scratch_pool), @@ -316,7 +317,8 @@ add_file(const char *local_abspath, } /* Add the file */ - SVN_ERR(svn_wc_add_from_disk2(ctx->wc_ctx, local_abspath, properties, + SVN_ERR(svn_wc_add_from_disk3(ctx->wc_ctx, local_abspath, properties, + FALSE /* skip checks */, ctx->notify_func2, ctx->notify_baton2, pool)); return SVN_NO_ERROR; @@ -378,7 +380,8 @@ add_dir_recursive(const char *dir_abspath, iterpool = svn_pool_create(scratch_pool); /* Add this directory to revision control. */ - err = svn_wc_add_from_disk2(ctx->wc_ctx, dir_abspath, NULL /*props*/, + err = svn_wc_add_from_disk3(ctx->wc_ctx, dir_abspath, NULL /*props*/, + FALSE /* skip checks */, ctx->notify_func2, ctx->notify_baton2, iterpool); if (err) @@ -424,8 +427,8 @@ add_dir_recursive(const char *dir_abspath, version control. */ for (hi = apr_hash_first(scratch_pool, dirents); hi; hi = apr_hash_next(hi)) { - const char *name = svn__apr_hash_index_key(hi); - svn_io_dirent2_t *dirent = svn__apr_hash_index_val(hi); + const char *name = apr_hash_this_key(hi); + svn_io_dirent2_t *dirent = apr_hash_this_val(hi); const char *abspath; svn_pool_clear(iterpool); @@ -704,15 +707,12 @@ svn_client__get_all_auto_props(apr_hash_t **autoprops, for (i = 0; i < inherited_config_auto_props->nelts; i++) { - apr_hash_index_t *hi; svn_prop_inherited_item_t *elt = APR_ARRAY_IDX( inherited_config_auto_props, i, svn_prop_inherited_item_t *); + const svn_string_t *propval = + svn_hash_gets(elt->prop_hash, SVN_PROP_INHERITABLE_AUTO_PROPS); - for (hi = apr_hash_first(scratch_pool, elt->prop_hash); - hi; - hi = apr_hash_next(hi)) { - const svn_string_t *propval = svn__apr_hash_index_val(hi); const char *ch = propval->data; svn_stringbuf_t *config_auto_prop_pattern; svn_stringbuf_t *config_auto_prop_val; @@ -768,59 +768,6 @@ svn_client__get_all_auto_props(apr_hash_t **autoprops, return SVN_NO_ERROR; } -svn_error_t *svn_client__get_inherited_ignores(apr_array_header_t **ignores, - const char *path_or_url, - svn_client_ctx_t *ctx, - apr_pool_t *result_pool, - apr_pool_t *scratch_pool) -{ - svn_opt_revision_t rev; - apr_hash_t *explicit_ignores; - apr_array_header_t *inherited_ignores; - svn_boolean_t target_is_url = svn_path_is_url(path_or_url); - svn_string_t *explicit_prop; - int i; - - if (target_is_url) - rev.kind = svn_opt_revision_head; - else - rev.kind = svn_opt_revision_working; - - SVN_ERR(svn_client_propget5(&explicit_ignores, &inherited_ignores, - SVN_PROP_INHERITABLE_IGNORES, path_or_url, - &rev, &rev, NULL, svn_depth_empty, NULL, ctx, - scratch_pool, scratch_pool)); - - explicit_prop = svn_hash_gets(explicit_ignores, path_or_url); - - if (explicit_prop) - { - svn_prop_inherited_item_t *new_iprop = - apr_palloc(scratch_pool, sizeof(*new_iprop)); - new_iprop->path_or_url = path_or_url; - new_iprop->prop_hash = apr_hash_make(scratch_pool); - svn_hash_sets(new_iprop->prop_hash, SVN_PROP_INHERITABLE_IGNORES, - explicit_prop); - APR_ARRAY_PUSH(inherited_ignores, - svn_prop_inherited_item_t *) = new_iprop; - } - - *ignores = apr_array_make(result_pool, 16, sizeof(const char *)); - - for (i = 0; i < inherited_ignores->nelts; i++) - { - svn_prop_inherited_item_t *elt = APR_ARRAY_IDX( - inherited_ignores, i, svn_prop_inherited_item_t *); - svn_string_t *ignore_val = svn_hash_gets(elt->prop_hash, - SVN_PROP_INHERITABLE_IGNORES); - if (ignore_val) - svn_cstring_split_append(*ignores, ignore_val->data, "\n\r\t\v ", - FALSE, result_pool); - } - - return SVN_NO_ERROR; -} - /* The main logic of the public svn_client_add5. * * EXISTING_PARENT_ABSPATH is the absolute path to the first existing @@ -841,7 +788,7 @@ add(const char *local_abspath, svn_magic__cookie_t *magic_cookie; apr_array_header_t *ignores = NULL; - svn_magic__init(&magic_cookie, scratch_pool); + SVN_ERR(svn_magic__init(&magic_cookie, ctx->config, scratch_pool)); if (existing_parent_abspath) { @@ -876,8 +823,9 @@ add(const char *local_abspath, parent_abspath, local_abspath); SVN_ERR(svn_io_make_dir_recursively(parent_abspath, scratch_pool)); - SVN_ERR(svn_wc_add_from_disk2(ctx->wc_ctx, parent_abspath, + SVN_ERR(svn_wc_add_from_disk3(ctx->wc_ctx, parent_abspath, NULL /*props*/, + FALSE /* skip checks */, ctx->notify_func2, ctx->notify_baton2, scratch_pool)); } @@ -1169,8 +1117,8 @@ mkdir_urls(const apr_array_header_t *urls, } } } - qsort(targets->elts, targets->nelts, targets->elt_size, - svn_sort_compare_paths); + + svn_sort__array(targets, svn_sort_compare_paths); /* ### This reparent may be problematic in limited-authz-to-common-parent ### scenarios (compare issue #3242). See also issue #3649. */ @@ -1228,53 +1176,58 @@ mkdir_urls(const apr_array_header_t *urls, pool)); /* Call the path-based editor driver. */ - err = svn_delta_path_driver2(editor, edit_baton, targets, TRUE, - path_driver_cb_func, (void *)editor, pool); + err = svn_error_trace( + svn_delta_path_driver2(editor, edit_baton, targets, TRUE, + path_driver_cb_func, (void *)editor, pool)); if (err) { /* At least try to abort the edit (and fs txn) before throwing err. */ return svn_error_compose_create( err, - editor->abort_edit(edit_baton, pool)); + svn_error_trace(editor->abort_edit(edit_baton, pool))); + } + + if (ctx->notify_func2) + { + svn_wc_notify_t *notify; + notify = svn_wc_create_notify_url(common, + svn_wc_notify_commit_finalizing, + pool); + ctx->notify_func2(ctx->notify_baton2, notify, pool); } /* Close the edit. */ - return editor->close_edit(edit_baton, pool); + return svn_error_trace(editor->close_edit(edit_baton, pool)); } svn_error_t * -svn_client__make_local_parents(const char *path, +svn_client__make_local_parents(const char *local_abspath, svn_boolean_t make_parents, svn_client_ctx_t *ctx, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { svn_error_t *err; svn_node_kind_t orig_kind; - SVN_ERR(svn_io_check_path(path, &orig_kind, pool)); + SVN_ERR(svn_io_check_path(local_abspath, &orig_kind, scratch_pool)); if (make_parents) - SVN_ERR(svn_io_make_dir_recursively(path, pool)); + SVN_ERR(svn_io_make_dir_recursively(local_abspath, scratch_pool)); else - SVN_ERR(svn_io_dir_make(path, APR_OS_DEFAULT, pool)); + SVN_ERR(svn_io_dir_make(local_abspath, APR_OS_DEFAULT, scratch_pool)); - /* Should no longer use svn_depth_empty to indicate that only the directory - itself is added, since it not only constraints the operation depth, but - also defines the depth of the target directory now. Moreover, the new - directory will have no children at all.*/ - err = svn_client_add5(path, svn_depth_infinity, FALSE, FALSE, FALSE, - make_parents, ctx, pool); + err = svn_client_add5(local_abspath, svn_depth_empty, FALSE, FALSE, FALSE, + make_parents, ctx, scratch_pool); /* If we created a new directory, but couldn't add it to version control, then delete it. */ if (err && (orig_kind == svn_node_none)) { - /* ### If this returns an error, should we link it onto - err instead, so that the user is warned that we just - created an unversioned directory? */ - - svn_error_clear(svn_io_remove_dir2(path, FALSE, NULL, NULL, pool)); + err = svn_error_compose_create(err, + svn_io_remove_dir2(local_abspath, FALSE, + NULL, NULL, + scratch_pool)); } return svn_error_trace(err); @@ -1303,23 +1256,25 @@ svn_client_mkdir4(const apr_array_header_t *paths, else { /* This is a regular "mkdir" + "svn add" */ - apr_pool_t *subpool = svn_pool_create(pool); + apr_pool_t *iterpool = svn_pool_create(pool); int i; for (i = 0; i < paths->nelts; i++) { const char *path = APR_ARRAY_IDX(paths, i, const char *); - svn_pool_clear(subpool); + svn_pool_clear(iterpool); /* See if the user wants us to stop. */ if (ctx->cancel_func) SVN_ERR(ctx->cancel_func(ctx->cancel_baton)); + SVN_ERR(svn_dirent_get_absolute(&path, path, iterpool)); + SVN_ERR(svn_client__make_local_parents(path, make_parents, ctx, - subpool)); + iterpool)); } - svn_pool_destroy(subpool); + svn_pool_destroy(iterpool); } return SVN_NO_ERROR; |