You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2012/05/10 01:07:41 UTC

svn commit: r1336442 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_client/copy.c libsvn_wc/adm_files.c

Author: philip
Date: Wed May  9 23:07:40 2012
New Revision: 1336442

URL: http://svn.apache.org/viewvc?rev=1336442&view=rev
Log:
A step to enable exclusive wc.db locking, issue 4176.

* subversion/include/private/svn_wc_private.h
  (svn_wc__get_tmpdir): New wrapper.

* subversion/libsvn_wc/adm_files.c
  (svn_wc__get_tmpdir): New wrapper.

* subversion/libsvn_client/copy.c
  (repos_to_wc_copy_single): Use new wrapper to avoid reopening wc.db.

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_client/copy.c
    subversion/trunk/subversion/libsvn_wc/adm_files.c

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1336442&r1=1336441&r2=1336442&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Wed May  9 23:07:40 2012
@@ -1034,6 +1034,16 @@ svn_wc__rename_wc(svn_wc_context_t *wc_c
                   const char *dst_abspath,
                   apr_pool_t *scratch_pool);
 
+/* Set *TMPDIR_ABSPATH to a directory that is suitable for temporary
+   files which may need to be moved (atomically and same-device) into
+   the working copy indicated by LOCAL_ABSPATH.  */
+svn_error_t *
+svn_wc__get_tmpdir(const char **tmpdir_abspath,
+                   svn_wc_context_t *wc_ctx,
+                   const char *local_abspath,
+                   apr_pool_t *result_pool,
+                   apr_pool_t *scratch_pool);
+
 /* Gets information needed by the commit harvester.
  *
  * ### Currently this API is work in progress and is designed for just this

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=1336442&r1=1336441&r2=1336442&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Wed May  9 23:07:40 2012
@@ -1475,13 +1475,16 @@ repos_to_wc_copy_single(svn_client__copy
   if (pair->src_kind == svn_node_dir)
     {
       svn_boolean_t sleep_needed = FALSE;
-      const char *tmp_abspath;
+      const char *tmpdir_abspath, *tmp_abspath;
 
       /* Find a temporary location in which to check out the copy source.
        * (This function is deprecated, but we intend to replace this whole
        * code path with something else.) */
-      SVN_ERR(svn_wc_create_tmp_file2(NULL, &tmp_abspath, dst_abspath,
-                                      svn_io_file_del_on_close, pool));
+      SVN_ERR(svn_wc__get_tmpdir(&tmpdir_abspath, ctx->wc_ctx, dst_abspath,
+                                 pool, pool));
+                                 
+      SVN_ERR(svn_io_open_unique_file3(NULL, &tmp_abspath, tmpdir_abspath,
+                                       svn_io_file_del_on_close, pool, pool));
 
       /* Make a new checkout of the requested source. While doing so,
        * resolve pair->src_revnum to an actual revision number in case it

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.c?rev=1336442&r1=1336441&r2=1336442&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.c Wed May  9 23:07:40 2012
@@ -634,3 +634,16 @@ svn_wc_create_tmp_file2(apr_file_t **fp,
 
   return SVN_NO_ERROR;
 }
+
+svn_error_t *
+svn_wc__get_tmpdir(const char **tmpdir_abspath,
+                   svn_wc_context_t *wc_ctx,
+                   const char *local_abspath,
+                   apr_pool_t *result_pool,
+                   apr_pool_t *scratch_pool)
+{
+  SVN_ERR(svn_wc__db_temp_wcroot_tempdir(tmpdir_abspath,
+                                         wc_ctx->db, local_abspath,
+                                         result_pool, scratch_pool));
+  return SVN_NO_ERROR;
+}



Re: svn commit: r1336442 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_client/copy.c libsvn_wc/adm_files.c

Posted by Greg Stein <gs...@gmail.com>.
On Wed, May 9, 2012 at 7:07 PM,  <ph...@apache.org> wrote:
>...
> +++ subversion/trunk/subversion/include/private/svn_wc_private.h Wed May  9 23:07:40 2012
> @@ -1034,6 +1034,16 @@ svn_wc__rename_wc(svn_wc_context_t *wc_c
>                   const char *dst_abspath,
>                   apr_pool_t *scratch_pool);
>
> +/* Set *TMPDIR_ABSPATH to a directory that is suitable for temporary
> +   files which may need to be moved (atomically and same-device) into
> +   the working copy indicated by LOCAL_ABSPATH.  */
> +svn_error_t *
> +svn_wc__get_tmpdir(const char **tmpdir_abspath,
> +                   svn_wc_context_t *wc_ctx,
> +                   const char *local_abspath,
> +                   apr_pool_t *result_pool,
> +                   apr_pool_t *scratch_pool);

These should be WRI_ABSPATH for consistent variable naming (your
docstring already uses the term "indicator").

>...
> +++ subversion/trunk/subversion/libsvn_client/copy.c Wed May  9 23:07:40 2012
> @@ -1475,13 +1475,16 @@ repos_to_wc_copy_single(svn_client__copy
>   if (pair->src_kind == svn_node_dir)
>     {
>       svn_boolean_t sleep_needed = FALSE;
> -      const char *tmp_abspath;
> +      const char *tmpdir_abspath, *tmp_abspath;
>
>       /* Find a temporary location in which to check out the copy source.
>        * (This function is deprecated, but we intend to replace this whole
>        * code path with something else.) */
> -      SVN_ERR(svn_wc_create_tmp_file2(NULL, &tmp_abspath, dst_abspath,
> -                                      svn_io_file_del_on_close, pool));
> +      SVN_ERR(svn_wc__get_tmpdir(&tmpdir_abspath, ctx->wc_ctx, dst_abspath,
> +                                 pool, pool));

The comment is now out of date .... __get_tmpdir() is not deprecated.

>...

Cheers,
-g