On Wed, Feb 22, 2012 at 12:05 PM, Philip Martin
<philip.mar...@wandisco.com> wrote:
> Paul Burba <ptbu...@gmail.com> writes:
>
>> Index: subversion/libsvn_client/copy.c
>> ===================================================================
>> --- subversion/libsvn_client/copy.c   (revision 1292379)
>> +++ subversion/libsvn_client/copy.c   (working copy)
>> @@ -1519,6 +1519,17 @@
>>          ctx->notify_baton2 = old_notify_baton2;
>>
>>          SVN_ERR(err);
>> +
>> +#ifdef WIN32
>> +        if (!ignore_externals)
>> +          {
>> +            /* Issue #4123: We may still hold file handles to the databases
>> +               for externals under TMP_ABSPATH.  We need to release these
>> +               handles before we move TMP_ABSPATH below or Windows will
>> +               raise an ERROR_ACCESS_DENIED error. */
>> +            SVN_ERR(svn_wc__externals_close(tmp_abspath, ctx->wc_ctx, 
>> pool));
>> +          }
>> +#endif
>
> I'm not sure why this would be windows specific.  Yes, Linux lets us
> move the dir with the handle open but I think it would be an error for
> the Subversion client to use the handle after the move.

Hi Philip,

OK, both you and Bert pointed this out, so it's gone.

> Is this the best way to do it?  It isn't what I was expecting.  I was
> expecting the checkout code to explicitly close the handles it was
> responsible for opening.  Then the copy code would not have to do
> anything special.

Are you thinking within svn_client__checkout_internal or from its
caller, like the attached patch?

Paul
Index: subversion/include/private/svn_wc_private.h
===================================================================
--- subversion/include/private/svn_wc_private.h (revision 1292379)
+++ subversion/include/private/svn_wc_private.h (working copy)
@@ -263,6 +263,15 @@
                                      apr_pool_t *result_pool,
                                      apr_pool_t *scratch_pool);
 
+/* Close the DB for LOCAL_ABSPATH.  Perform temporary allocations in
+   SCRATCH_POOL.
+   
+   Wraps svn_wc__db_drop_root(). */
+svn_error_t *
+svn_wc__close_db(const char *external_abspath,
+                 svn_wc_context_t *wc_ctx,
+                 apr_pool_t *scratch_pool);
+
 /** Set @a *tree_conflict to a newly allocated @c
  * svn_wc_conflict_description_t structure describing the tree
  * conflict state of @a victim_abspath, or to @c NULL if @a victim_abspath
Index: subversion/libsvn_client/externals.c
===================================================================
--- subversion/libsvn_client/externals.c        (revision 1292379)
+++ subversion/libsvn_client/externals.c        (working copy)
@@ -299,6 +299,9 @@
                                       external_peg_rev,
                                       external_rev,
                                       pool));
+    /* Issue #4123: We don't need to keep the newly checked out external's
+       DB open. */
+    SVN_ERR(svn_wc__close_db(local_abspath, ctx->wc_ctx, pool));
   }
 
   return SVN_NO_ERROR;
Index: subversion/libsvn_wc/externals.c
===================================================================
--- subversion/libsvn_wc/externals.c    (revision 1292379)
+++ subversion/libsvn_wc/externals.c    (working copy)
@@ -1363,6 +1363,16 @@
     }
 }
 
+svn_error_t *
+svn_wc__close_db(const char *external_abspath,
+                 svn_wc_context_t *wc_ctx,
+                 apr_pool_t *scratch_pool)
+{
+  SVN_ERR(svn_wc__db_drop_root(wc_ctx->db, external_abspath,
+                               scratch_pool));
+  return SVN_NO_ERROR;
+}
+
 /* Return the scheme of @a uri in @a scheme allocated from @a pool.
    If @a uri does not appear to be a valid URI, then @a scheme will
    not be updated.  */

Reply via email to