subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1848063 - in /subversion/trunk/subversion: include/private/svn_client_private.h libsvn_client/copy.c libsvn_client/copy_foreign.c tests/libsvn_client/client-test.c
Date Mon, 03 Dec 2018 16:38:52 GMT
Author: julianfoad
Date: Mon Dec  3 16:38:52 2018
New Revision: 1848063

URL: http://svn.apache.org/viewvc?rev=1848063&view=rev
Log:
Simplify the physical implementation of foreign-repo copy.

For issue #4786 "Create a WC working-mods editor".

* subversion/include/private/svn_client_private.h
  (svn_client__copy_foreign): Remove.

* subversion/libsvn_client/copy.c
  (copy_foreign_dir): New here, moved from copy_foreign.c.
  (svn_client__repos_to_wc_copy_dir): Call copy_foreign_dir() directly
    instead of through svn_client__foreign_copy().
  (svn_client__repos_to_wc_copy): Allow a null 'timestamp_sleep' output ptr.

* subversion/libsvn_client/copy_foreign.c
  Delete this file; move copy_foreign_dir() to copy.c.

* subversion/tests/libsvn_client/client-test.c
  (test_foreign_repos_copy): Update callers of svn_client__copy_foreign()
    to use svn_client__repos_to_wc_copy() instead.

Removed:
    subversion/trunk/subversion/libsvn_client/copy_foreign.c
Modified:
    subversion/trunk/subversion/include/private/svn_client_private.h
    subversion/trunk/subversion/libsvn_client/copy.c
    subversion/trunk/subversion/tests/libsvn_client/client-test.c

Modified: subversion/trunk/subversion/include/private/svn_client_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_client_private.h?rev=1848063&r1=1848062&r2=1848063&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_client_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_client_private.h Mon Dec  3 16:38:52 2018
@@ -281,28 +281,6 @@ svn_client__wc_node_get_origin(svn_clien
                                apr_pool_t *result_pool,
                                apr_pool_t *scratch_pool);
 
-/* Copy the file or directory at LOC to DST_ABSPATH,
- * copying node information and properties.
- *
- * If URL specifies a directory, create the copy using depth DEPTH.
- *
- * If MAKE_PARENTS is TRUE and DST_ABSPATH doesn't have an added parent
- * create missing parent directories
- *
- * The caller should be holding a WC write lock that allows DST_ABSPATH to
- * be created, such as on the parent of DST_ABSPATH.
- *
- * Use RA_SESSION to fetch the data. The session may point to a different
- * URL after returning.
- */
-svn_error_t *
-svn_client__copy_foreign(const svn_client__pathrev_t *loc,
-                         const char *dst_abspath,
-                         svn_depth_t depth,
-                         svn_ra_session_t *ra_session,
-                         svn_client_ctx_t *ctx,
-                         apr_pool_t *scratch_pool);
-
 /* Same as the public svn_client_mergeinfo_log2 API, except for the addition
  * of the TARGET_MERGEINFO_CATALOG and RESULT_POOL parameters.
  *

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=1848063&r1=1848062&r2=1848063&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Mon Dec  3 16:38:52 2018
@@ -2353,6 +2353,65 @@ notification_adjust_func(void *baton,
     nb->inner_func(nb->inner_baton, inner_notify, pool);
 }
 
+/** Copy a directory tree from a remote repository.
+ *
+ * Copy from RA_SESSION:LOCATION, depth DEPTH, to WC_CTX:DST_ABSPATH.
+ *
+ * Create the directory DST_ABSPATH, if not present. Its parent should be
+ * already under version control in the WC and in a suitable state for
+ * scheduling the addition of a child.
+ *
+ * Ignore any incoming non-regular properties (entry-props, DAV/WC-props).
+ * Remove any incoming 'svn:mergeinfo' properties.
+ */
+static svn_error_t *
+copy_foreign_dir(svn_ra_session_t *ra_session,
+                 const svn_client__pathrev_t *location,
+                 const char *dst_abspath,
+                 svn_depth_t depth,
+                 svn_wc_notify_func2_t notify_func,
+                 void *notify_baton,
+                 svn_cancel_func_t cancel_func,
+                 void *cancel_baton,
+                 svn_client_ctx_t *ctx,
+                 apr_pool_t *scratch_pool)
+{
+  const svn_delta_editor_t *editor;
+  void *eb;
+  const svn_delta_editor_t *wrapped_editor;
+  void *wrapped_baton;
+  const svn_ra_reporter3_t *reporter;
+  void *reporter_baton;
+
+  /* Get a WC editor. It does not need an RA session because we will not
+     be sending it any 'copy from' requests, only 'add' requests. */
+  SVN_ERR(svn_client__wc_editor_internal(&editor, &eb,
+                                         dst_abspath,
+                                         TRUE /*root_dir_add*/,
+                                         TRUE /*ignore_mergeinfo_changes*/,
+                                         notify_func, notify_baton,
+                                         NULL /*ra_session*/,
+                                         ctx, scratch_pool));
+
+  SVN_ERR(svn_delta_get_cancellation_editor(cancel_func, cancel_baton,
+                                            editor, eb,
+                                            &wrapped_editor, &wrapped_baton,
+                                            scratch_pool));
+
+  SVN_ERR(svn_ra_do_update3(ra_session, &reporter, &reporter_baton,
+                            location->rev, "", svn_depth_infinity,
+                            FALSE, FALSE, wrapped_editor, wrapped_baton,
+                            scratch_pool, scratch_pool));
+
+  SVN_ERR(reporter->set_path(reporter_baton, "", location->rev, depth,
+                             TRUE /* incomplete */,
+                             NULL, scratch_pool));
+
+  SVN_ERR(reporter->finish_report(reporter_baton, scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
 /* Implementation of svn_client__repos_to_wc_copy() for a dir.
  */
 static svn_error_t *
@@ -2378,11 +2437,13 @@ svn_client__repos_to_wc_copy_dir(svn_boo
       SVN_ERR(svn_client__pathrev_create_with_session(&location, ra_session,
                                                       src_revnum, src_url,
                                                       scratch_pool));
-      SVN_ERR(svn_client__copy_foreign(location,
-                                       dst_abspath,
-                                       svn_depth_infinity,
-                                       ra_session,
-                                       ctx, scratch_pool));
+      SVN_ERR(svn_ra_reparent(ra_session, src_url, scratch_pool));
+      SVN_ERR(copy_foreign_dir(ra_session, location,
+                               dst_abspath,
+                               svn_depth_infinity,
+                               ctx->notify_func2, ctx->notify_baton2,
+                               ctx->cancel_func, ctx->cancel_baton,
+                               ctx, scratch_pool));
 
       return SVN_NO_ERROR;
     }
@@ -2518,6 +2579,11 @@ svn_client__repos_to_wc_copy(svn_boolean
                              svn_client_ctx_t *ctx,
                              apr_pool_t *scratch_pool)
 {
+  svn_boolean_t timestamp_sleep_ignored;
+
+  if (!timestamp_sleep)
+    timestamp_sleep = &timestamp_sleep_ignored;
+
   if (kind == svn_node_dir)
     {
       SVN_ERR(svn_client__repos_to_wc_copy_dir(timestamp_sleep,

Modified: subversion/trunk/subversion/tests/libsvn_client/client-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_client/client-test.c?rev=1848063&r1=1848062&r2=1848063&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/client-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/client-test.c Mon Dec  3 16:38:52 2018
@@ -31,6 +31,7 @@
 #include "../../libsvn_client/client.h"
 #include "svn_pools.h"
 #include "svn_client.h"
+#include "private/svn_client_private.h"
 #include "private/svn_client_mtcc.h"
 #include "svn_repos.h"
 #include "svn_subst.h"
@@ -765,17 +766,22 @@ test_foreign_repos_copy(const svn_test_o
 
   loc->url = svn_path_url_add_component2(repos2_url, "A", pool);
   SVN_WC__CALL_WITH_WRITE_LOCK(
-    svn_client__copy_foreign(loc,
+    svn_client__repos_to_wc_copy(NULL /*sleep*/, svn_node_dir,
+                             loc->url, loc->rev,
                              svn_dirent_join(wc_path, "A-copied", pool),
-                             svn_depth_infinity,
+                             /*svn_depth_infinity,*/
+                             FALSE /*same_repositories*/,
                              ra_session, ctx, pool),
     ctx->wc_ctx, wc_path, FALSE, pool);
 
+  SVN_ERR(svn_ra_reparent(ra_session, repos2_url, pool));
   loc->url = svn_path_url_add_component2(repos2_url, "iota", pool);
   SVN_WC__CALL_WITH_WRITE_LOCK(
-    svn_client__copy_foreign(loc,
+    svn_client__repos_to_wc_copy(NULL /*sleep*/, svn_node_file,
+                             loc->url, loc->rev,
                              svn_dirent_join(wc_path, "iota-copied", pool),
-                             svn_depth_infinity,
+                             /*svn_depth_infinity,*/
+                             FALSE /*same_repositories*/,
                              ra_session, ctx, pool),
     ctx->wc_ctx, wc_path, FALSE, pool);
 



Mime
View raw message