Author: rhuijben
Date: Mon Apr  4 16:34:25 2011
New Revision: 1088680

URL: http://svn.apache.org/viewvc?rev=1088680&view=rev
Log:
Resolve an access denied error triggered by copy_tests.py 12 "repository to
working-copy copy", but ignored because the test accepted any error.

* subversion/include/private/svn_wc_private.h
  (svn_wc__rename_wc): New function.

* subversion/libsvn_client/copy.c
  (repos_to_wc_copy_single): Use svn_wc__rename_wc() instead of a direct io
    operation to allow releasing the wc_db file handle before moving.

* subversion/libsvn_wc/node.c
  (svn_wc__rename_wc): New function.

* subversion/tests/cmdline/copy_tests.py
  (repos_to_wc): Expect a specific error instead of a generic failure

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_client/copy.c
    subversion/trunk/subversion/libsvn_wc/node.c
    subversion/trunk/subversion/tests/cmdline/copy_tests.py

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=1088680&r1=1088679&r2=1088680&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Mon Apr  4 
16:34:25 2011
@@ -903,6 +903,16 @@ svn_wc__has_local_mods(svn_boolean_t *is
                        void *cancel_baton,
                        apr_pool_t *scratch_pool);
 
+/* Renames a working copy from @a from_abspath to @a dst_abspath and makes sure
+   open handles are closed to allow this on all platforms.
+
+   Summary: This avoids a file lock problem on wc.db on Windows, that is
+            triggered by libsvn_client'ss copy to working copy code. */
+svn_error_t *
+svn_wc__rename_wc(svn_wc_context_t *wc_ctx,
+                  const char *from_abspath,
+                  const char *dst_abspath,
+                  apr_pool_t *scratch_pool);
 
 /* Gets information needed by the commit harvester.
  *

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=1088680&r1=1088679&r2=1088680&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Mon Apr  4 16:34:25 2011
@@ -1525,7 +1525,7 @@ repos_to_wc_copy_single(svn_client__copy
         }
 
       /* Move the temporary disk tree into place. */
-      SVN_ERR(svn_io_file_rename(tmp_abspath, dst_abspath, pool));
+      SVN_ERR(svn_wc__rename_wc(ctx->wc_ctx, tmp_abspath, dst_abspath, pool));
 
       if (! same_repositories)
         {

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1088680&r1=1088679&r2=1088680&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Mon Apr  4 16:34:25 2011
@@ -1734,3 +1734,18 @@ svn_wc__node_get_commit_status(svn_node_
 
   return SVN_NO_ERROR;
 }
+
+svn_error_t *
+svn_wc__rename_wc(svn_wc_context_t *wc_ctx,
+                  const char *from_abspath,
+                  const char *dst_abspath,
+                  apr_pool_t *scratch_pool)
+{
+  SVN_ERR(svn_wc__db_temp_forget_directory(wc_ctx->db,
+                                           from_abspath,
+                                           scratch_pool));
+
+  SVN_ERR(svn_io_file_rename(from_abspath, dst_abspath, scratch_pool));
+
+  return SVN_NO_ERROR;
+}

Modified: subversion/trunk/subversion/tests/cmdline/copy_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/copy_tests.py?rev=1088680&r1=1088679&r2=1088680&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/copy_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/copy_tests.py Mon Apr  4 16:34:25 
2011
@@ -980,8 +980,9 @@ def repos_to_wc(sbox):
   E_url = other_repo_url + "/A/B/E"
   pi_url = other_repo_url + "/A/D/G/pi"
 
-  # Expect an error in the directory case
-  svntest.actions.run_and_verify_svn(None, None, svntest.verify.AnyOutput,
+  # Expect an error in the directory case until we allow this copy to succeed.
+  expected_error = "svn: E200007: Source URL '.*foreign repository"
+  svntest.actions.run_and_verify_svn(None, None, expected_error,
                                      'copy', E_url, wc_dir)
 
   # But file case should work fine.


Reply via email to