Author: stsp
Date: Sat Jul 30 10:52:20 2011
New Revision: 1152449

URL: http://svn.apache.org/viewvc?rev=1152449&view=rev
Log:
Make commit refuse to commit the delete-half of a move separately from
the copied-half.

* subversion/libsvn_client/commit.c
  (svn_client_commit5): If a deleted commit target was moved-away
   refuse to perform the commit unless the copied-half of the move
   is among the commit targets.

* subversion/tests/cmdline/copy_tests.py
  (commit_deleted_half_of_move): Remove XFail marker.

Modified:
    subversion/trunk/subversion/libsvn_client/commit.c
    subversion/trunk/subversion/tests/cmdline/copy_tests.py

Modified: subversion/trunk/subversion/libsvn_client/commit.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit.c?rev=1152449&r1=1152448&r2=1152449&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit.c Sat Jul 30 10:52:20 2011
@@ -1447,7 +1447,35 @@ svn_client_commit5(const apr_array_heade
                 }
             }
         }
-      /* ### TODO: check the delete-half, too */
+      else if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE)
+        {
+          const char *moved_to_abspath;
+          const char *copy_op_root_abspath;
+
+          cmt_err = svn_error_trace(svn_wc__node_was_moved_away(
+                                      &moved_to_abspath,
+                                      &copy_op_root_abspath,
+                                      ctx->wc_ctx, item->path,
+                                      iterpool, iterpool));
+          if (cmt_err)
+            goto cleanup;
+
+          if (moved_to_abspath && copy_op_root_abspath &&
+              strcmp(moved_to_abspath, copy_op_root_abspath) == 0 &&
+              apr_hash_get(committables->by_path, copy_op_root_abspath,
+                           APR_HASH_KEY_STRING) == NULL)
+            {
+              cmt_err = svn_error_createf(
+                          SVN_ERR_ILLEGAL_TARGET, NULL,
+                         _("Cannot commit '%s' because it was moved to '%s' "
+                           "which is not part of the commit; both sides of "
+                           "the move must be committed together"),
+                         svn_dirent_local_style(item->path, iterpool),
+                         svn_dirent_local_style(copy_op_root_abspath,
+                                                iterpool));
+              goto cleanup;
+            }
+        }
     }
 
   /* Go get a log message.  If an error occurs, or no log message is

Modified: subversion/trunk/subversion/tests/cmdline/copy_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/copy_tests.py?rev=1152449&r1=1152448&r2=1152449&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/copy_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/copy_tests.py Sat Jul 30 10:52:20 
2011
@@ -5526,7 +5526,6 @@ def commit_copied_half_of_nested_move(sb
 
 
 @Issue(3631)
-@XFail()
 def commit_deleted_half_of_move(sbox):
   "attempt to commit the deleted part of move"
   sbox.build(read_only = True)


Reply via email to