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

[PATCH] Add "--non-recursive" flag for export - v3

From: Daniel Patterson <danpat_at_danpat.net>
Date: 2005-02-21 10:16:06 CET

kfogel@collab.net wrote:
> Thanks for the new patch.
>
> There's a bug, though: when you do an export from a working copy
> (instead of from a URL), the new -N flag is just ignored. It should
> have the same effect when the source is a working copy as when the
> source is a URL.
>

   Hmm, my bad, I've never used that feature, I didn't even know it
   existed.

   Updated log message below, updated patch attached. Still no
   test cases, my Python literacy is not great.

[[[
Add --non-recursive parameter to "svn export"

* subversion/libsvn_client/export.c:
   (svn_client_export3): add new "recursive" parameter that
   gets passed through to svn_ra_do_update. Also, if exporting
   from a working copy, pass the recursive flag through to
   copy_versioned_files (which has been updated), see below.
   (svn_client_export2): default to passing TRUE for new
   "recurse" parameter
   (copy_versioned_files): add a recursive parameter and
   only do a recursive copy if it's true.

* subversion/include/svn_client.h:
   (svn_client_export3): update public API to include new
   "recursive" parameter"

* subversion/libsvn_client/externals.c:
   (handle_external_item_change): update call to
   svn_client_export3 to pass TRUE as the recursive value.
   When traversing externals, if we're doing a nonrecursive
   export, we should never get to this point, so TRUE should
   always be the case.

* subversion/clients/cmdlind/export-cmd.c:
   (svn_cl__export): use updated svn_client_export3 function and pass
   inverse of --non-recursive command line through. Still defaults
   to the original behaviour of a recursive export.

* subversion/clients/cmdline/main.c:
   (svn_cl__cmd_table[]): add "N" option to "export" command

]]]

Index: subversion/include/svn_client.h
===================================================================
--- subversion/include/svn_client.h (revision 13095)
+++ subversion/include/svn_client.h (working copy)
@@ -1588,6 +1588,9 @@
  * will use the standard eol marker. Any other value will cause the
  * SVN_ERR_IO_UNKNOWN_EOL error to be returned.
  *
+ * @a recurse passes through to svn_ra_do_update to make exports of
+ * directories recursive if TRUE.
+ *
  * All allocations are done in @a pool.
  */
 svn_error_t *
@@ -1598,6 +1601,7 @@
                     const svn_opt_revision_t *revision,
                     svn_boolean_t force,
                     svn_boolean_t ignore_externals,
+ svn_boolean_t recurse,
                     const char *native_eol,
                     svn_client_ctx_t *ctx,
                     apr_pool_t *pool);
Index: subversion/libsvn_client/externals.c
===================================================================
--- subversion/libsvn_client/externals.c (revision 13095)
+++ subversion/libsvn_client/externals.c (working copy)
@@ -245,7 +245,8 @@
         SVN_ERR (svn_client_export3 (NULL, new_item->url, path,
                                      &(new_item->revision),
                                      &(new_item->revision),
- TRUE, FALSE, NULL, ib->ctx, ib->pool));
+ TRUE, FALSE, TRUE, NULL,
+ ib->ctx, ib->pool));
       else
         SVN_ERR (svn_client__checkout_internal (NULL, new_item->url, path,
                                                 &(new_item->revision),
Index: subversion/libsvn_client/export.c
===================================================================
--- subversion/libsvn_client/export.c (revision 13095)
+++ subversion/libsvn_client/export.c (working copy)
@@ -214,6 +214,7 @@
                       const char *to,
                       svn_opt_revision_t *revision,
                       svn_boolean_t force,
+ svn_boolean_t recurse,
                       const char *native_eol,
                       svn_client_ctx_t *ctx,
                       apr_pool_t *pool)
@@ -301,12 +302,17 @@
                 }
               else
                 {
- const char *new_from = svn_path_join (from, item, iterpool);
- const char *new_to = svn_path_join (to, item, iterpool);
+ if (recurse)
+ {
+ const char *new_from = svn_path_join (from, item,
+ iterpool);
+ const char *new_to = svn_path_join (to, item, iterpool);
                   
- SVN_ERR (copy_versioned_files (new_from, new_to, revision,
- force, native_eol, ctx,
- iterpool));
+ SVN_ERR (copy_versioned_files (new_from, new_to,
+ revision, force, recurse,
+ native_eol, ctx,
+ iterpool));
+ }
                 }
             }
           else if (*type == svn_node_file)
@@ -745,6 +751,7 @@
                     const svn_opt_revision_t *revision,
                     svn_boolean_t force,
                     svn_boolean_t ignore_externals,
+ svn_boolean_t recurse,
                     const char *native_eol,
                     svn_client_ctx_t *ctx,
                     apr_pool_t *pool)
@@ -852,7 +859,7 @@
                                       &reporter, &report_baton,
                                       revnum,
                                       "", /* no sub-target */
- TRUE, /* recurse */
+ recurse, /* recurse */
                                       export_editor, edit_baton, pool));
 
           SVN_ERR (reporter->set_path (report_baton, "", revnum,
@@ -894,7 +901,7 @@
       
       /* just copy the contents of the working copy into the target path. */
       SVN_ERR (copy_versioned_files (from, to, &working_revision, force,
- native_eol, ctx, pool));
+ recurse, native_eol, ctx, pool));
     }
   
 
@@ -930,7 +937,8 @@
   peg_revision.kind = svn_opt_revision_unspecified;
 
   return svn_client_export3 (result_rev, from, to, &peg_revision,
- revision, force, FALSE, native_eol, ctx, pool);
+ revision, force, FALSE, TRUE,
+ native_eol, ctx, pool);
 }
 
   
Index: subversion/clients/cmdline/export-cmd.c
===================================================================
--- subversion/clients/cmdline/export-cmd.c (revision 13095)
+++ subversion/clients/cmdline/export-cmd.c (working copy)
@@ -74,6 +74,7 @@
   err = svn_client_export3 (NULL, truefrom, to, &peg_revision,
                             &(opt_state->start_revision),
                             opt_state->force, opt_state->ignore_externals,
+ opt_state->nonrecursive ? FALSE : TRUE,
                             opt_state->native_eol, ctx,
                             pool);
   if (err && err->apr_err == SVN_ERR_WC_OBSTRUCTED_UPDATE && !opt_state->force)
Index: subversion/clients/cmdline/main.c
===================================================================
--- subversion/clients/cmdline/main.c (revision 13095)
+++ subversion/clients/cmdline/main.c (working copy)
@@ -322,7 +322,7 @@
        " If specified, PEGREV determines in which revision the target is "
        "first\n"
        " looked up.\n"),
- {'r', 'q', svn_cl__force_opt, SVN_CL__AUTH_OPTIONS,
+ {'r', 'q', 'N', svn_cl__force_opt, SVN_CL__AUTH_OPTIONS,
      svn_cl__config_dir_opt, svn_cl__native_eol_opt,
      svn_cl__ignore_externals_opt} },
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Feb 21 10:18:03 2005

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.