Index: subversion-1.4.2/subversion/libsvn_client/copy.c =================================================================== --- subversion-1.4.2.orig/subversion/libsvn_client/copy.c +++ subversion-1.4.2/subversion/libsvn_client/copy.c @@ -271,7 +271,8 @@ repos_to_repos_copy(svn_commit_info_t ** const char *dst_url, svn_client_ctx_t *ctx, svn_boolean_t is_move, - apr_pool_t *pool) + apr_pool_t *pool, + svn_boolean_t replace) { apr_array_header_t *paths = apr_array_make(pool, 2, sizeof(const char *)); const char *top_url, *src_rel, *dst_rel, *message, *repos_root; @@ -392,20 +393,27 @@ repos_to_repos_copy(svn_commit_info_t ** /* Figure out the basename that will result from this operation. */ SVN_ERR(svn_ra_check_path(ra_session, dst_rel, youngest, &dst_kind, pool)); + svn_client_commit_item2_t *item; + apr_array_header_t *commit_items + = apr_array_make(pool, 2, sizeof(item)); if (dst_kind != svn_node_none) { - /* We disallow the overwriting of existing paths. */ - return svn_error_createf(SVN_ERR_FS_ALREADY_EXISTS, NULL, - _("Path '%s' already exists"), dst_rel); + if (replace) { + item = apr_pcalloc(pool, sizeof(*item)); + item->url = svn_path_join(top_url, dst_rel, pool); + item->state_flags = SVN_CLIENT_COMMIT_ITEM_DELETE; + APR_ARRAY_PUSH(commit_items, svn_client_commit_item2_t *) = item; + } else { + /* We disallow the overwriting of existing paths. */ + return svn_error_createf(SVN_ERR_FS_ALREADY_EXISTS, NULL, + _("Path '%s' already exists"), dst_rel); + } } /* Create a new commit item and add it to the array. */ if (ctx->log_msg_func || ctx->log_msg_func2) { - svn_client_commit_item2_t *item; const char *tmp_file; - apr_array_header_t *commit_items - = apr_array_make(pool, 2, sizeof(item)); item = apr_pcalloc(pool, sizeof(*item)); item->url = svn_path_join(top_url, dst_rel, pool); @@ -942,7 +950,8 @@ setup_copy(svn_commit_info_t **commit_in svn_boolean_t is_move, svn_boolean_t force, svn_client_ctx_t *ctx, - apr_pool_t *pool) + apr_pool_t *pool, + svn_boolean_t replace) { svn_boolean_t src_is_url, dst_is_url; @@ -1036,7 +1045,7 @@ setup_copy(svn_commit_info_t **commit_in else { SVN_ERR(repos_to_repos_copy(commit_info_p, src_path, src_revision, - dst_path, ctx, is_move, pool)); + dst_path, ctx, is_move, pool, replace)); } return SVN_NO_ERROR; @@ -1052,14 +1061,16 @@ svn_client_copy3(svn_commit_info_t **com const svn_opt_revision_t *src_revision, const char *dst_path, svn_client_ctx_t *ctx, - apr_pool_t *pool) + apr_pool_t *pool, + svn_boolean_t replace) { return setup_copy(commit_info_p, src_path, src_revision, dst_path, FALSE /* is_move */, TRUE /* force, set to avoid deletion check */, ctx, - pool); + pool, + replace); } @@ -1074,7 +1085,7 @@ svn_client_copy2(svn_commit_info_t **com svn_error_t *err; err = svn_client_copy3(commit_info_p, src_path, src_revision, - dst_path, ctx, pool); + dst_path, ctx, pool, FALSE); /* If the target exists, try to copy the source as a child of the target. This will obviously fail if target is not a directory, but that's exactly @@ -1088,7 +1099,7 @@ svn_client_copy2(svn_commit_info_t **com return svn_client_copy3(commit_info_p, src_path, src_revision, svn_path_join(dst_path, src_basename, pool), - ctx, pool); + ctx, pool, FALSE); } return err; @@ -1128,7 +1139,8 @@ svn_client_move4(svn_commit_info_t **com TRUE /* is_move */, force, ctx, - pool); + pool, + FALSE); } svn_error_t * @@ -1210,7 +1222,8 @@ svn_client_move(svn_client_commit_info_t TRUE /* is_move */, force, ctx, - pool); + pool, + FALSE); /* These structs have the same layout for the common fields. */ *commit_info_p = (svn_client_commit_info_t *) commit_info; return err; Index: subversion-1.4.2/subversion/svn/cl.h =================================================================== --- subversion-1.4.2.orig/subversion/svn/cl.h +++ subversion-1.4.2/subversion/svn/cl.h @@ -77,7 +77,8 @@ typedef enum { svn_cl__summarize, svn_cl__targets_opt, svn_cl__version_opt, - svn_cl__xml_opt + svn_cl__xml_opt, + svn_cl__replace_opt } svn_cl__longopt_t; @@ -143,6 +144,7 @@ typedef struct svn_cl__opt_state_t svn_boolean_t no_autoprops; /* disable automatic properties */ const char *native_eol; /* override system standard eol marker */ svn_boolean_t summarize; /* create a summary of a diff */ + svn_boolean_t replace; /* replace destination on repo-to-repo copy */ } svn_cl__opt_state_t; Index: subversion-1.4.2/subversion/svn/main.c =================================================================== --- subversion-1.4.2.orig/subversion/svn/main.c +++ subversion-1.4.2/subversion/svn/main.c @@ -184,6 +184,8 @@ const apr_getopt_option_t svn_cl__option N_("don't unlock the targets")}, {"summarize", svn_cl__summarize, 0, N_("show a summary of the results")}, + {"replace", svn_cl__replace_opt, 0, + N_("replace destination if it exists on a repo-to-repo copy")}, {0, 0, 0, 0} }; @@ -299,7 +301,7 @@ const svn_opt_subcommand_desc2_t svn_cl_ " URL -> WC: check out URL into WC, schedule for addition\n" " URL -> URL: complete server-side copy; used to branch & tag\n"), {'r', 'q', - SVN_CL__LOG_MSG_OPTIONS, SVN_CL__AUTH_OPTIONS, svn_cl__config_dir_opt} }, + SVN_CL__LOG_MSG_OPTIONS, SVN_CL__AUTH_OPTIONS, svn_cl__config_dir_opt, svn_cl__replace_opt} }, { "delete", svn_cl__delete, {"del", "remove", "rm"}, N_ ("Remove files and directories from version control.\n" @@ -1196,6 +1198,9 @@ main(int argc, const char *argv[]) case svn_cl__summarize: opt_state.summarize = TRUE; break; + case svn_cl__replace_opt: + opt_state.replace = TRUE; + break; default: /* Hmmm. Perhaps this would be a good place to squirrel away opts that commands like svn diff might need. Hmmm indeed. */ Index: subversion-1.4.2/subversion/include/svn_client.h =================================================================== --- subversion-1.4.2.orig/subversion/include/svn_client.h +++ subversion-1.4.2/subversion/include/svn_client.h @@ -1816,7 +1816,8 @@ svn_client_copy3(svn_commit_info_t **com const svn_opt_revision_t *src_revision, const char *dst_path, svn_client_ctx_t *ctx, - apr_pool_t *pool); + apr_pool_t *pool, + svn_boolean_t replace); /** Similar to svn_client_copy3(), with the difference that if @a dst_path Index: subversion-1.4.2/subversion/svn/copy-cmd.c =================================================================== --- subversion-1.4.2.orig/subversion/svn/copy-cmd.c +++ subversion-1.4.2/subversion/svn/copy-cmd.c @@ -114,7 +114,7 @@ svn_cl__copy(apr_getopt_t *os, err = svn_client_copy3(&commit_info, src_path, &(opt_state->start_revision), - dst_path, ctx, pool); + dst_path, ctx, pool, opt_state->replace); /* If dst_path already exists, try to copy src_path as a child of it. */ if (err && (err->apr_err == SVN_ERR_ENTRY_EXISTS @@ -127,7 +127,7 @@ svn_cl__copy(apr_getopt_t *os, err = svn_client_copy3(&commit_info, src_path, &(opt_state->start_revision), svn_path_join(dst_path, src_basename, pool), - ctx, pool); + ctx, pool, FALSE); } if (ctx->log_msg_func2)