You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2011/10/14 18:06:35 UTC

svn commit: r1183403 - /subversion/trunk/subversion/libsvn_wc/wc_db.c

Author: stsp
Date: Fri Oct 14 16:06:34 2011
New Revision: 1183403

URL: http://svn.apache.org/viewvc?rev=1183403&view=rev
Log:
Follow-up to r1183358:
* subversion/libsvn_wc/wc_db.c
  (op_delete_txn): When deleting the op-root of a copied-half of a move,
    clear moved-to information at the delete-half. This way, deleting the
    copied half has the same effect as reverting it.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db.c

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1183403&r1=1183402&r2=1183403&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Oct 14 16:06:34 2011
@@ -6403,6 +6403,33 @@ op_delete_txn(void *baton,
         }
 
       select_depth = relpath_depth(local_relpath);
+
+      /* When deleting a moved-here op-root, clear moved-to data at the
+       * pre-move location, transforming the move into a normal delete.
+       * This way, deleting the copied half of a move has the same effect
+       * as reverting it. */
+      if (status == svn_wc__db_status_added ||
+          status == svn_wc__db_status_moved_here)
+        {
+          const char *moved_from_relpath;
+          const char *moved_from_op_root_relpath;
+
+          SVN_ERR(scan_addition(&status, NULL, NULL, NULL, NULL, NULL, NULL,
+                                &moved_from_relpath,
+                                &moved_from_op_root_relpath,
+                                wcroot, local_relpath,
+                                scratch_pool, scratch_pool));
+          if (status == svn_wc__db_status_moved_here &&
+              moved_from_relpath && moved_from_op_root_relpath &&
+              strcmp(moved_from_relpath, moved_from_op_root_relpath) == 0)
+            {
+              SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                                STMT_CLEAR_MOVED_TO_RELPATH));
+              SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id,
+                                        moved_from_op_root_relpath));
+              SVN_ERR(svn_sqlite__step_done(stmt));
+            }
+        }
     }
   else
     {