LOG:
Fix issue #1296: --force option for svn export
* clients/cmdline/main.c: Add svn_cl__force_opt for export in
svn_cl__options.
* clients/cmdline/export-cmd.c, include/svn_client.h:
Interface of svn_client_export() is changed. A new argument named force.
* libsvn_clients/export.c
(svn_client_export, svn_client__get_export_editor):
Interface is changed. A new argument named force.
(struct edit_baton): A new force field is added.
(open_root, add_directory): If a --force option is specified, an
existing directory is no longer an error.
PATCH:
--- subversion/clients/cmdline/main.c.orig Sat May 10 09:02:58 2003
+++ subversion/clients/cmdline/main.c Sun May 18 00:49:40 2003
@@ -226,7 +226,7 @@
" 2. Exports a clean directory tree from the working copy specified by\n"
" PATH1 into PATH2. all local changes will be preserved, but files\n"
" not under revision control will not be copied.\n",
- {'r', 'q', SVN_CL__AUTH_OPTIONS} },
+ {'r', 'q', svn_cl__force_opt, SVN_CL__AUTH_OPTIONS} },
{ "help", svn_cl__help, {"?", "h"},
"Display this usage message.\n"
--- subversion/clients/cmdline/export-cmd.c.orig Sat May 10 09:03:00 2003
+++ subversion/clients/cmdline/export-cmd.c Sun May 18 00:51:56 2003
@@ -71,6 +71,7 @@
SVN_ERR (svn_client_export (from,
to,
&(opt_state->start_revision),
+ opt_state->force,
ctx,
pool));
return SVN_NO_ERROR;
--- subversion/include/svn_client.h.orig Sun May 18 00:43:58 2003
+++ subversion/include/svn_client.h Sun May 18 00:44:18 2003
@@ -1186,6 +1186,7 @@
svn_client_export (const char *from,
const char *to,
svn_opt_revision_t *revision,
+ svn_boolean_t force,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
--- subversion/libsvn_client/export.c.orig Sat May 10 09:05:54 2003
+++ subversion/libsvn_client/export.c Mon May 19 10:08:18 2003
@@ -140,6 +140,7 @@
svn_client_export (const char *from,
const char *to,
svn_opt_revision_t *revision,
+ svn_boolean_t force,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
@@ -155,7 +156,7 @@
URL = svn_path_canonicalize (from, pool);
SVN_ERR (svn_client__get_export_editor (&export_editor, &edit_baton,
- to, URL, ctx, pool));
+ to, URL, force, ctx, pool));
if (revision->kind == svn_opt_revision_number)
revnum = revision->value.number;
@@ -194,6 +195,7 @@
{
const char *root_path;
const char *root_url;
+ svn_boolean_t force;
svn_wc_notify_func_t notify_func;
void *notify_baton;
@@ -305,11 +307,15 @@
svn_node_kind_t kind;
SVN_ERR (svn_io_check_path (eb->root_path, &kind, pool));
- if (kind != svn_node_none)
- return svn_error_create (SVN_ERR_WC_OBSTRUCTED_UPDATE,
- NULL, eb->root_path);
-
- SVN_ERR (svn_io_dir_make (eb->root_path, APR_OS_DEFAULT, pool));
+ if ( kind == svn_node_none )
+ {
+ SVN_ERR (svn_io_dir_make (eb->root_path, APR_OS_DEFAULT, pool));
+ }
+ else if (! (kind == svn_node_dir && eb->force))
+ {
+ return svn_error_create (SVN_ERR_WC_OBSTRUCTED_UPDATE,
+ NULL, eb->root_path);
+ }
if (eb->notify_func)
(*eb->notify_func) (eb->notify_baton,
@@ -338,8 +344,18 @@
struct edit_baton *eb = parent_baton;
const char *full_path = svn_path_join (eb->root_path,
path, pool);
+ svn_node_kind_t kind;
- SVN_ERR (svn_io_dir_make (full_path, APR_OS_DEFAULT, pool));
+ SVN_ERR (svn_io_check_path (full_path, &kind, pool));
+ if ( kind == svn_node_none )
+ {
+ SVN_ERR (svn_io_dir_make (full_path, APR_OS_DEFAULT, pool));
+ }
+ else if (! (kind == svn_node_dir && eb->force))
+ {
+ return svn_error_create (SVN_ERR_WC_OBSTRUCTED_UPDATE,
+ NULL, eb->root_path);
+ }
if (eb->notify_func)
(*eb->notify_func) (eb->notify_baton,
@@ -545,6 +561,7 @@
void **edit_baton,
const char *root_path,
const char *root_url,
+ svn_boolean_t force,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
@@ -553,6 +570,7 @@
eb->root_path = apr_pstrdup (pool, root_path);
eb->root_url = apr_pstrdup (pool, root_url);
+ eb->force = force;
eb->notify_func = ctx->notify_func;
eb->notify_baton = ctx->notify_baton;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon May 19 04:31:15 2003