[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: patch to libsvn_client/export.c

From: plasma <plasmaball_at_pchome.com.tw>
Date: 2003-05-18 08:18:21 CEST

On Sat, May 17, 2003 at 11:20:47AM -0500, cmpilato@collab.net wrote:
> William Uther <willu.mailingLists@cse.unsw.edu.au> writes:
> > On Saturday, May 17, 2003, at 09:58 PM, plasma wrote:
> > > On Fri, May 16, 2003 at 11:26:41PM -0500, cmpilato@collab.net wrote:
> > > Since the patch is here, if you core members find it acceptable, maybe
> > > you would like to add a new option to complete this issue? I would be
> > > appreciate since I prefer 'svn export' do things this way.
> >
> > This sounds like a job for --force.
>
> Sound good to me.

I just found my previous patch got something wrong. But seems it
never reached dev mailing list, I'm composing a new email.

This is a patch to add a --force option to 'svn export'. Because I'm
a novice at C programming, please don't laugh if anything stupid is
made.

plasma

LOG:

Issue #1296. Add a new --force option to 'svn export'.

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 Sun May 18 14:00:09 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,22 @@
   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);
+ if (eb->force)
+ {
+ if (kind == svn_node_none)
+ SVN_ERR (svn_io_dir_make (eb->root_path, APR_OS_DEFAULT, pool));
+ else if (kind == svn_node_file)
+ return svn_error_create (SVN_ERR_WC_OBSTRUCTED_UPDATE,
+ NULL, eb->root_path);
+ }
+ else
+ {
+ 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));
+ }
 
- SVN_ERR (svn_io_dir_make (eb->root_path, APR_OS_DEFAULT, pool));
 
   if (eb->notify_func)
     (*eb->notify_func) (eb->notify_baton,
@@ -338,8 +351,21 @@
   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));
+ if (eb->force)
+ {
+ 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_file)
+ return svn_error_create (SVN_ERR_WC_OBSTRUCTED_UPDATE,
+ NULL, eb->root_path);
+ }
+ else
+ {
+ SVN_ERR (svn_io_dir_make (full_path, APR_OS_DEFAULT, pool));
+ }
 
   if (eb->notify_func)
     (*eb->notify_func) (eb->notify_baton,
@@ -545,6 +571,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 +580,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;
 
==========================================================
 New Galant·R±¡°O¨Æ²¼¿ï±o¤j¼ú
 http://edm-prg.epaper.com.tw/click.php?ad_code=7745
==========================================================
 PChomeÁʪ«¡G¥xÆW²Ä¤@ªºÁʪ«ºô¯¸¡I
 http://shopping.pchome.com.tw/
==========================================================

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun May 18 08:19:19 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.