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

Re: Parallel checkout within checkout

From: Stefan Sperling <stsp_at_elego.de>
Date: Mon, 8 Jul 2013 23:18:15 +0200

On Sun, Jul 07, 2013 at 01:39:33PM -0500, Frank Loeffler wrote:
> On Sun, Jul 07, 2013 at 06:34:09PM +0200, Stefan Sperling wrote:
> > By design, there are many cases where the working copy code ends up
> > searching the directory hierarchy upwards for a wc.db database in
> > a .svn directory.
>
> Does it stop once it finds one, or does it continue to search further
> up? I would assume it stops, since it only needs one database. If it
> stops, then a new checkout would only be 'in trouble', as long as it's
> own database isn't present yet if I understand this correctly. Then the
> next question would be when this is created during a checkout: close to
> the beginning or when the checkout is finished. It probably has to be
> closer to the beginning, since the checkout code has to work with that
> new database, and not another that might happen to live in some parent
> directory. If this is the case, then I would imagine that the critical
> code during checkout that shouldn't look 'up' might not be that large.
>
> Of course, this chain of arguments contained a lot of assumptions and it
> would take someone more familiar with the code to comment on this.
> Depending on the results of such an initial assessment someone might be
> willing to look into it, or maybe not.
>
> Frank

This patch is sufficient to make it work in my testing.
Can you confirm?

Index: subversion/include/private/svn_wc_private.h
===================================================================
--- subversion/include/private/svn_wc_private.h (revision 1500871)
+++ subversion/include/private/svn_wc_private.h (working copy)
@@ -1863,6 +1863,35 @@ svn_wc__acquire_write_lock_for_resolve(const char
                                        const char *local_abspath,
                                        apr_pool_t *result_pool,
                                        apr_pool_t *scratch_pool);
+
+/** Create a new administrative area for @a local_abspath, so
+ * that @a local_abspath is a working copy subdir based on @a url at @a
+ * revision, with depth @a depth, and with repository UUID @a repos_uuid
+ * and repository root URL @a repos_root_url.
+ *
+ * @a depth must be a definite depth, it cannot be #svn_depth_unknown.
+ * @a repos_uuid and @a repos_root_url MUST NOT be @c NULL, and
+ * @a repos_root_url must be a prefix of @a url.
+ *
+ * If the administrative area already exists, raise an error.
+ *
+ * Do not ensure existence of @a local_abspath itself; if @a local_abspath
+ * does not exist, return error.
+ *
+ * Use @a scratch_pool for temporary allocations.
+ *
+ * @since New in 1.9.
+ */
+svn_error_t *
+svn_wc__init_adm(svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ const char *url,
+ const char *repos_root_url,
+ const char *repos_uuid,
+ svn_revnum_t revision,
+ svn_depth_t depth,
+ apr_pool_t *scratch_pool);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
Index: subversion/libsvn_client/checkout.c
===================================================================
--- subversion/libsvn_client/checkout.c (revision 1500871)
+++ subversion/libsvn_client/checkout.c (working copy)
@@ -58,9 +58,9 @@ initialize_area(const char *local_abspath,
     depth = svn_depth_infinity;
 
   /* Make the unversioned directory into a versioned one. */
- SVN_ERR(svn_wc_ensure_adm4(ctx->wc_ctx, local_abspath, pathrev->url,
- pathrev->repos_root_url, pathrev->repos_uuid,
- pathrev->rev, depth, pool));
+ SVN_ERR(svn_wc__init_adm(ctx->wc_ctx, local_abspath, pathrev->url,
+ pathrev->repos_root_url, pathrev->repos_uuid,
+ pathrev->rev, depth, pool));
   return SVN_NO_ERROR;
 }
 
Index: subversion/libsvn_wc/adm_files.c
===================================================================
--- subversion/libsvn_wc/adm_files.c (revision 1500871)
+++ subversion/libsvn_wc/adm_files.c (working copy)
@@ -517,6 +517,32 @@ svn_wc_ensure_adm4(svn_wc_context_t *wc_ctx,
 }
 
 svn_error_t *
+svn_wc__init_adm(svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ const char *url,
+ const char *repos_root_url,
+ const char *repos_uuid,
+ svn_revnum_t revision,
+ svn_depth_t depth,
+ apr_pool_t *scratch_pool)
+
+{
+ const char *repos_relpath = svn_uri_skip_ancestor(repos_root_url, url,
+ scratch_pool);
+
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+ SVN_ERR_ASSERT(url != NULL);
+ SVN_ERR_ASSERT(repos_root_url != NULL);
+ SVN_ERR_ASSERT(repos_uuid != NULL);
+ SVN_ERR_ASSERT(repos_relpath != NULL);
+ SVN_ERR_ASSERT(depth != svn_depth_unknown);
+
+ return svn_error_trace(init_adm(wc_ctx->db, local_abspath,
+ repos_relpath, repos_root_url, repos_uuid,
+ revision, depth, scratch_pool));
+}
+
+svn_error_t *
 svn_wc__adm_destroy(svn_wc__db_t *db,
                     const char *dir_abspath,
                     svn_cancel_func_t cancel_func,
Received on 2013-07-08 23:18:54 CEST

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