Index: subversion/include/svn_client.h =================================================================== --- subversion/include/svn_client.h (revision 14771) +++ subversion/include/svn_client.h (working copy) @@ -630,11 +630,28 @@ * @a ctx->notify_func2 with @a ctx->notify_baton2 and the path of the * added item. * + * Use @a no_ignore to indicate that files and directories that match + * ignore patterns should be added. + * * Important: this is a *scheduling* operation. No changes will * happen to the repository until a commit occurs. This scheduling * can be removed with svn_client_revert(). */ svn_error_t * +svn_client_add3 (const char *path, + svn_boolean_t recursive, + svn_boolean_t force, + svn_boolean_t no_ignore, + svn_client_ctx_t *ctx, + apr_pool_t *pool); + +/** + * @deprecated Provided for backward compatibility with the 1.2 API. + * + * Similar to svn_client_add3(), but with the @a no_ignore parameter + * always set to @c FALSE. + */ +svn_error_t * svn_client_add2 (const char *path, svn_boolean_t recursive, svn_boolean_t force, @@ -744,6 +761,9 @@ * Use @a nonrecursive to indicate that imported directories should not * recurse into any subdirectories they may have. * + * Use @a no_ignore to indicate that files and directories that match + * ignore patterns should be imported. + * * ### kff todo: This import is similar to cvs import, in that it does * not change the source tree into a working copy. However, this * behavior confuses most people, and I think eventually svn _should_ @@ -751,6 +771,20 @@ * option. However, doing so is a bit involved, and we don't need it * right now. */ +svn_error_t *svn_client_import2 (svn_client_commit_info_t **commit_info, + const char *path, + const char *url, + svn_boolean_t nonrecursive, + svn_boolean_t no_ignore, + svn_client_ctx_t *ctx, + apr_pool_t *pool); + +/** + * @deprecated Provided for backward compatibility with the 1.2 API. + * + * Similar to svn_client_import except for @a no_ignore set to FALSE + * always. + */ svn_error_t *svn_client_import (svn_client_commit_info_t **commit_info, const char *path, const char *url, @@ -758,7 +792,6 @@ svn_client_ctx_t *ctx, apr_pool_t *pool); - /** @since New in 1.2. * * Commit files or directories into repository, authenticating with Index: subversion/libsvn_client/add.c =================================================================== --- subversion/libsvn_client/add.c (revision 14771) +++ subversion/libsvn_client/add.c (working copy) @@ -266,6 +266,7 @@ add_dir_recursive (const char *dirname, svn_wc_adm_access_t *adm_access, svn_boolean_t force, + svn_boolean_t no_ignore, svn_client_ctx_t *ctx, apr_pool_t *pool) { @@ -293,7 +294,8 @@ SVN_ERR (svn_wc_adm_retrieve (&dir_access, adm_access, dirname, pool)); - SVN_ERR (svn_wc_get_default_ignores (&ignores, ctx->config, pool)); + if (!no_ignore) + SVN_ERR (svn_wc_get_default_ignores (&ignores, ctx->config, pool)); /* Create a subpool for iterative memory control. */ subpool = svn_pool_create (pool); @@ -322,8 +324,11 @@ || (this_entry.name[1] == '.' && this_entry.name[2] == '\0'))) continue; - if (svn_cstring_match_glob_list (this_entry.name, ignores)) - continue; + if (!no_ignore) + { + if (svn_cstring_match_glob_list (this_entry.name, ignores)) + continue; + } /* Construct the full path of the entry. */ fullpath = svn_path_join (dirname, this_entry.name, subpool); @@ -332,7 +337,7 @@ if (this_entry.filetype == APR_DIR) { SVN_ERR (add_dir_recursive (fullpath, dir_access, force, - ctx, subpool)); + no_ignore, ctx, subpool)); } else if (this_entry.filetype != APR_UNKFILE) { @@ -384,6 +389,7 @@ add (const char *path, svn_boolean_t recursive, svn_boolean_t force, + svn_boolean_t no_ignore, svn_wc_adm_access_t *adm_access, svn_client_ctx_t *ctx, apr_pool_t *pool) @@ -393,7 +399,7 @@ SVN_ERR (svn_io_check_path (path, &kind, pool)); if ((kind == svn_node_dir) && recursive) - err = add_dir_recursive (path, adm_access, force, ctx, pool); + err = add_dir_recursive (path, adm_access, force, no_ignore, ctx, pool); else if (kind == svn_node_file) err = add_file (path, ctx, adm_access, pool); else @@ -426,7 +432,7 @@ TRUE, 0, ctx->cancel_func, ctx->cancel_baton, pool)); - err = add (path, recursive, FALSE, adm_access, ctx, pool); + err = add (path, recursive, FALSE, FALSE, adm_access, ctx, pool); err2 = svn_wc_adm_close (adm_access); if (err2) @@ -442,9 +448,10 @@ svn_error_t * -svn_client_add2 (const char *path, +svn_client_add3 (const char *path, svn_boolean_t recursive, svn_boolean_t force, + svn_boolean_t no_ignore, svn_client_ctx_t *ctx, apr_pool_t *pool) { @@ -456,7 +463,7 @@ TRUE, 0, ctx->cancel_func, ctx->cancel_baton, pool)); - err = add (path, recursive, force, adm_access, ctx, pool); + err = add (path, recursive, force, no_ignore, adm_access, ctx, pool); err2 = svn_wc_adm_close (adm_access); if (err2) @@ -470,6 +477,20 @@ return err; } +svn_error_t * +svn_client_add2 (const char *path, + svn_boolean_t recursive, + svn_boolean_t force, + svn_client_ctx_t *ctx, + apr_pool_t *pool) +{ + return svn_client_add3 (path, + recursive, + force, + FALSE, + ctx, + pool); +} static svn_error_t * path_driver_cb_func (void **dir_baton, Index: subversion/libsvn_client/commit.c =================================================================== --- subversion/libsvn_client/commit.c (revision 14771) +++ subversion/libsvn_client/commit.c (working copy) @@ -297,6 +297,7 @@ const char *edit_path, svn_boolean_t nonrecursive, apr_hash_t *excludes, + svn_boolean_t no_ignore, import_ctx_t *import_ctx, svn_client_ctx_t *ctx, apr_pool_t *pool) @@ -308,7 +309,8 @@ SVN_ERR (svn_path_check_valid (path, pool)); - SVN_ERR (svn_wc_get_default_ignores (&ignores, ctx->config, pool)); + if (!no_ignore) + SVN_ERR (svn_wc_get_default_ignores (&ignores, ctx->config, pool)); SVN_ERR (svn_io_get_dirents (&dirents, path, pool)); @@ -364,8 +366,11 @@ if (apr_hash_get (excludes, abs_path, APR_HASH_KEY_STRING)) continue; - if (svn_cstring_match_glob_list (filename, ignores)) - continue; + if (!no_ignore) + { + if (svn_cstring_match_glob_list (filename, ignores)) + continue; + } /* We only import subdirectories when we're doing a regular recursive import. */ @@ -399,9 +404,10 @@ } /* Recurse. */ - SVN_ERR (import_dir (editor, this_dir_baton, - this_path, this_edit_path, - FALSE, excludes, import_ctx, ctx, subpool)); + SVN_ERR (import_dir (editor, this_dir_baton, this_path, + this_edit_path, FALSE, excludes, + no_ignore, import_ctx, ctx, + subpool)); /* Finally, close the sub-directory. */ SVN_ERR (editor->close_directory (this_dir_baton, subpool)); @@ -441,9 +447,6 @@ * If CTX->NOTIFY_FUNC is non-null, invoke it with CTX->NOTIFY_BATON for * each imported path, passing actions svn_wc_notify_commit_added. * - * EXCLUDES is a hash whose keys are absolute paths to exclude from - * the import (values are unused). - * * Use POOL for any temporary allocation. * * Note: the repository directory receiving the import was specified @@ -458,6 +461,7 @@ void *edit_baton, svn_boolean_t nonrecursive, apr_hash_t *excludes, + svn_boolean_t no_ignore, svn_client_ctx_t *ctx, apr_pool_t *pool) { @@ -522,15 +526,22 @@ if (kind == svn_node_file) { - SVN_ERR (svn_wc_get_default_ignores (&ignores, ctx->config, pool)); - if (! svn_cstring_match_glob_list (path, ignores)) + svn_boolean_t ignores_match; + + if (!no_ignore) + { + SVN_ERR (svn_wc_get_default_ignores (&ignores, ctx->config, pool)); + ignores_match = svn_cstring_match_glob_list (path, ignores); + } + if ((no_ignore) || (!ignores_match)) SVN_ERR (import_file (editor, root_baton, path, edit_path, import_ctx, ctx, pool)); } else if (kind == svn_node_dir) { SVN_ERR (import_dir (editor, root_baton, path, edit_path, - nonrecursive, excludes, import_ctx, ctx, pool)); + nonrecursive, excludes, no_ignore, import_ctx, + ctx, pool)); } else if (kind == svn_node_none) @@ -616,12 +627,13 @@ /*** Public Interfaces. ***/ svn_error_t * -svn_client_import (svn_client_commit_info_t **commit_info, - const char *path, - const char *url, - svn_boolean_t nonrecursive, - svn_client_ctx_t *ctx, - apr_pool_t *pool) +svn_client_import2 (svn_client_commit_info_t **commit_info, + const char *path, + const char *url, + svn_boolean_t nonrecursive, + svn_boolean_t no_ignore, + svn_client_ctx_t *ctx, + apr_pool_t *pool) { svn_error_t *err = SVN_NO_ERROR; const char *log_msg = ""; @@ -743,7 +755,7 @@ /* If an error occurred during the commit, abort the edit and return the error. We don't even care if the abort itself fails. */ if ((err = import (path, new_entries, editor, edit_baton, - nonrecursive, excludes, ctx, subpool))) + nonrecursive, excludes, no_ignore, ctx, subpool))) { svn_error_clear (editor->abort_edit (edit_baton, subpool)); return err; @@ -768,7 +780,19 @@ return SVN_NO_ERROR; } +svn_error_t * +svn_client_import (svn_client_commit_info_t **commit_info, + const char *path, + const char *url, + svn_boolean_t nonrecursive, + svn_client_ctx_t *ctx, + apr_pool_t *pool) +{ + return svn_client_import2 (commit_info, path, url, nonrecursive, + FALSE, ctx, pool); +} + static svn_error_t * remove_tmpfiles (apr_hash_t *tempfiles, apr_pool_t *pool) Index: subversion/clients/cmdline/add-cmd.c =================================================================== --- subversion/clients/cmdline/add-cmd.c (revision 14771) +++ subversion/clients/cmdline/add-cmd.c (working copy) @@ -63,8 +63,9 @@ svn_pool_clear (subpool); SVN_ERR (svn_cl__check_cancel (ctx->cancel_baton)); - err = svn_client_add2 (target, (! opt_state->nonrecursive), - opt_state->force, ctx, subpool); + err = svn_client_add3 (target, (! opt_state->nonrecursive), + opt_state->force, opt_state->no_ignore, + ctx, subpool); if (err) { if (err->apr_err == SVN_ERR_ENTRY_EXISTS) Index: subversion/clients/cmdline/import-cmd.c =================================================================== --- subversion/clients/cmdline/import-cmd.c (revision 14771) +++ subversion/clients/cmdline/import-cmd.c (working copy) @@ -107,12 +107,13 @@ SVN_ERR (svn_cl__make_log_msg_baton (&(ctx->log_msg_baton), opt_state, NULL, ctx->config, pool)); SVN_ERR (svn_cl__cleanup_log_msg - (ctx->log_msg_baton, svn_client_import (&commit_info, - path, - url, - opt_state->nonrecursive, - ctx, - pool))); + (ctx->log_msg_baton, svn_client_import2 (&commit_info, + path, + url, + opt_state->nonrecursive, + opt_state->no_ignore, + ctx, + pool))); if (commit_info && ! opt_state->quiet) SVN_ERR (svn_cl__print_commit_info (commit_info, pool)); Index: subversion/clients/cmdline/main.c =================================================================== --- subversion/clients/cmdline/main.c (revision 14771) +++ subversion/clients/cmdline/main.c (working copy) @@ -183,7 +183,8 @@ "them for addition to repository. They will be added in next commit.\n" "usage: add PATH...\n"), {svn_cl__targets_opt, 'N', 'q', svn_cl__config_dir_opt, - svn_cl__force_opt, svn_cl__autoprops_opt, svn_cl__no_autoprops_opt} }, + svn_cl__force_opt, svn_cl__no_ignore_opt, svn_cl__autoprops_opt, + svn_cl__no_autoprops_opt} }, { "blame", svn_cl__blame, {"praise", "annotate", "ann"}, N_("Output the content of specified files or\n" @@ -351,7 +352,8 @@ " If PATH is a directory, the contents of the directory are added\n" " directly under URL.\n"), {'q', 'N', svn_cl__autoprops_opt, svn_cl__no_autoprops_opt, - SVN_CL__LOG_MSG_OPTIONS, SVN_CL__AUTH_OPTIONS, svn_cl__config_dir_opt} }, + SVN_CL__LOG_MSG_OPTIONS, svn_cl__no_ignore_opt, SVN_CL__AUTH_OPTIONS, + svn_cl__config_dir_opt} }, { "info", svn_cl__info, {0}, N_("Display information about a local or remote item.\n"