subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1410044 - in /subversion/trunk/subversion: libsvn_wc/copy.c tests/libsvn_wc/op-depth-test.c
Date Thu, 15 Nov 2012 21:54:39 GMT
Author: julianfoad
Date: Thu Nov 15 21:54:38 2012
New Revision: 1410044

URL: http://svn.apache.org/viewvc?rev=1410044&view=rev
Log:
Make svn_wc_copy3() and svn_wc__move2() check that they have been called
with the write lock(s) required by the doc string, like some other WC
functions do.  Fix op-depth-test.c to acquire the write lock before calling
svn_wc_copy3().

* subversion/libsvn_wc/copy.c
  (svn_wc_copy3, svn_wc__move2): Check we have the required write lock(s).

* subversion/tests/libsvn_wc/op-depth-test.c
  (wc_copy): Acquire a write lock before calling svn_wc_copy3().
  (wc_wc_copies): Use wc_copy() instead of calling svn_wc_copy3() directly.

Modified:
    subversion/trunk/subversion/libsvn_wc/copy.c
    subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c

Modified: subversion/trunk/subversion/libsvn_wc/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/copy.c?rev=1410044&r1=1410043&r2=1410044&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/copy.c (original)
+++ subversion/trunk/subversion/libsvn_wc/copy.c Thu Nov 15 21:54:38 2012
@@ -807,6 +807,11 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
              void *notify_baton,
              apr_pool_t *scratch_pool)
 {
+  /* Verify that we have the required write lock. */
+  SVN_ERR(svn_wc__write_check(wc_ctx->db,
+                              svn_dirent_dirname(dst_abspath, scratch_pool),
+                              scratch_pool));
+
   return svn_error_trace(copy_or_move(wc_ctx, src_abspath, dst_abspath,
                                       metadata_only, FALSE /* is_move */,
                                       TRUE /* allow_mixed_revisions */,
@@ -943,6 +948,14 @@ svn_wc__move2(svn_wc_context_t *wc_ctx,
 {
   svn_wc__db_t *db = wc_ctx->db;
 
+  /* Verify that we have the required write locks. */
+  SVN_ERR(svn_wc__write_check(wc_ctx->db,
+                              svn_dirent_dirname(src_abspath, scratch_pool),
+                              scratch_pool));
+  SVN_ERR(svn_wc__write_check(wc_ctx->db,
+                              svn_dirent_dirname(dst_abspath, scratch_pool),
+                              scratch_pool));
+
   SVN_ERR(copy_or_move(wc_ctx, src_abspath, dst_abspath,
                        TRUE /* metadata_only */,
                        TRUE /* is_move */,

Modified: subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c?rev=1410044&r1=1410043&r2=1410044&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Thu Nov 15 21:54:38 2012
@@ -154,10 +154,16 @@ disk_copy(svn_test__sandbox_t *b, const 
 static svn_error_t *
 wc_copy(svn_test__sandbox_t *b, const char *from_path, const char *to_path)
 {
+  const char *parent_abspath;
   from_path = wc_path(b, from_path);
   to_path = wc_path(b, to_path);
-  return svn_wc_copy3(b->wc_ctx, from_path, to_path, FALSE,
-                      NULL, NULL, NULL, NULL, b->pool);
+  parent_abspath = svn_dirent_dirname(to_path, b->pool);
+  SVN_ERR(svn_wc__acquire_write_lock(NULL, b->wc_ctx, parent_abspath, FALSE,
+                                     b->pool, b->pool));
+  SVN_ERR(svn_wc_copy3(b->wc_ctx, from_path, to_path, FALSE,
+                       NULL, NULL, NULL, NULL, b->pool));
+  SVN_ERR(svn_wc__release_write_lock(b->wc_ctx, parent_abspath, b->pool));
+  return SVN_NO_ERROR;
 }
 
 /* Revert a WC file or directory tree at PATH */
@@ -673,11 +679,7 @@ wc_wc_copies(svn_test__sandbox_t *b)
     /* Perform each subtest in turn. */
     for (subtest = subtests; subtest->from_path; subtest++)
       {
-        SVN_ERR(svn_wc_copy3(b->wc_ctx,
-                             wc_path(b, subtest->from_path),
-                             wc_path(b, subtest->to_path),
-                             FALSE /* metadata_only */,
-                             NULL, NULL, NULL, NULL, b->pool));
+        SVN_ERR(wc_copy(b, subtest->from_path, subtest->to_path));
         SVN_ERR(check_db_rows(b, subtest->to_path, subtest->expected));
       }
   }



Mime
View raw message