subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1361256 - in /subversion/trunk/subversion: libsvn_wc/adm_ops.c libsvn_wc/update_editor.c libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c libsvn_wc/wc_db.h tests/libsvn_wc/op-depth-test.c
Date Fri, 13 Jul 2012 15:03:34 GMT
Author: rhuijben
Date: Fri Jul 13 15:03:34 2012
New Revision: 1361256

URL: http://svn.apache.org/viewvc?rev=1361256&view=rev
Log:
Make 'svn rm' remove externals registrations below its targets.

We allow deleting parents of file externals (as we allow deleting
directories that contain switched paths) and directories that have
directory externals somewhere below them.

This patch removes the registration in the EXTERNALS table and for
file externals the entire file external so the next update will find
a normal working copy.

The new behavior is more what users expect, reduces the number of strange
database states and resolves some regressions since 1.6.

Suggested by: Dmitry Pavlenko <pavlenko{_AT_}tmatesoft.com>

* subversion/libsvn_wc/adm_ops.c
  (svn_wc__delete_internal): Update caller.

* subversion/libsvn_wc/update_editor.c
  (delete_entry): Update caller.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_DELETE_FILE_EXTERNALS,
   STMT_DELETE_FILE_EXTERNAL_REGISTATIONS,
   STMT_DELETE_EXTERNAL_REGISTATIONS): New statements.

* subversion/libsvn_wc/wc_db.c
  (op_delete_baton_t): Add delete_dir_externals.
  (delete_node): Delete externals if necessary.
  (op_delete_many_txn): Update caller.
  (svn_wc__db_op_delete): Pass delete_dir_externals.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_op_delete): Add delete_dir_externals argument and update
    documentation.
  (svn_wc__db_op_delete_many): Update documentation.

* subversion/tests/libsvn_wc/op-depth-test.c
  (do_delete): Update caller.
  (copy_file_externals): Update expected result.

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_ops.c
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h
    subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1361256&r1=1361255&r2=1361256&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Fri Jul 13 15:03:34 2012
@@ -875,6 +875,7 @@ svn_wc__delete_internal(svn_wc_context_t
         }
 
   SVN_ERR(svn_wc__db_op_delete(db, local_abspath, moved_to_abspath,
+                               !keep_local /* delete_dir_externals */,
                                NULL, work_items,
                                cancel_func, cancel_baton,
                                notify_func, notify_baton,

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1361256&r1=1361255&r2=1361256&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Fri Jul 13 15:03:34 2012
@@ -1872,7 +1872,7 @@ delete_entry(const char *path,
        * by deleting the node from the moved-away subtree. */
       /* ### This should probably use a work queue. */
       SVN_ERR(svn_wc__db_op_delete(eb->db, moved_to_abspath, NULL,
-                                   NULL, NULL,
+                                   FALSE, NULL, NULL,
                                    eb->cancel_func, eb->cancel_baton,
                                    NULL, NULL, /* notify below */
                                    scratch_pool));

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1361256&r1=1361255&r2=1361256&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri Jul 13 15:03:34 2012
@@ -968,6 +968,24 @@ SELECT presence, kind, def_local_relpath
 FROM externals WHERE wc_id = ?1 AND local_relpath = ?2
 LIMIT 1
 
+-- STMT_DELETE_FILE_EXTERNALS
+DELETE FROM nodes
+WHERE wc_id = ?1
+  AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
+  AND op_depth = 0
+  AND file_external IS NOT NULL
+
+-- STMT_DELETE_FILE_EXTERNAL_REGISTATIONS
+DELETE FROM externals
+WHERE wc_id = ?1
+  AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
+  AND kind != 'dir'
+
+-- STMT_DELETE_EXTERNAL_REGISTATIONS
+DELETE FROM externals
+WHERE wc_id = ?1
+  AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
+
 /* Select all committable externals, i.e. only unpegged ones on the same
  * repository as the target path ?2, that are defined by WC ?1 to
  * live below the target path. It does not matter which ancestor has the

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1361256&r1=1361255&r2=1361256&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Jul 13 15:03:34 2012
@@ -6842,6 +6842,7 @@ struct op_delete_baton_t {
   const char *moved_to_relpath; /* NULL if delete is not part of a move */
   svn_skel_t *conflict;
   svn_skel_t *work_items;
+  svn_boolean_t delete_dir_externals;
   svn_boolean_t notify;
 };
 
@@ -7193,6 +7194,18 @@ delete_node(void *baton,
         }
     }
 
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                    STMT_DELETE_FILE_EXTERNALS));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__step_done(stmt));
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                    b->delete_dir_externals
+                                    ? STMT_DELETE_EXTERNAL_REGISTATIONS
+                                    : STMT_DELETE_FILE_EXTERNAL_REGISTATIONS));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__step_done(stmt));
+
   SVN_ERR(add_work_items(wcroot->sdb, b->work_items, scratch_pool));
   if (b->conflict)
     SVN_ERR(mark_conflict(wcroot, local_relpath, b->conflict, scratch_pool));
@@ -7242,9 +7255,9 @@ op_delete_many_txn(void *baton,
       odb.moved_to_relpath = NULL;
       odb.conflict = NULL;
       odb.work_items = NULL;
+      odb.delete_dir_externals = odmb->delete_dir_externals;
       odb.notify = TRUE;
       SVN_ERR(delete_node(&odb, wcroot, target_relpath, iterpool));
-      /* ### TODO: Delete external registrations below target_relpath */
     }
   svn_pool_destroy(iterpool);
 
@@ -7310,6 +7323,7 @@ svn_error_t *
 svn_wc__db_op_delete(svn_wc__db_t *db,
                      const char *local_abspath,
                      const char *moved_to_abspath,
+                     svn_boolean_t delete_dir_externals,
                      svn_skel_t *conflict,
                      svn_skel_t *work_items,
                      svn_cancel_func_t cancel_func,
@@ -7358,6 +7372,7 @@ svn_wc__db_op_delete(svn_wc__db_t *db,
   odb.moved_to_relpath = moved_to_relpath;
   odb.conflict = conflict;
   odb.work_items = work_items;
+  odb.delete_dir_externals = delete_dir_externals;
 
   if (notify_func)
     {

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1361256&r1=1361255&r2=1361256&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Fri Jul 13 15:03:34 2012
@@ -1466,6 +1466,10 @@ svn_wc__db_temp_working_set_props(svn_wc
 
 /* Mark LOCAL_ABSPATH, and all children, for deletion.
  *
+ * This function removes the file externals (and if DELETE_DIR_EXTERNALS is
+ * TRUE also the directory externals) registered below LOCAL_ABSPATH.
+ * (DELETE_DIR_EXTERNALS should be true if also removing unversioned nodes)
+ *
  * If MOVED_TO_ABSPATH is not NULL, mark the deletion of LOCAL_ABSPATH
  * as the delete-half of a move from LOCAL_ABSPATH to MOVED_TO_ABSPATH.
  *
@@ -1481,6 +1485,7 @@ svn_error_t *
 svn_wc__db_op_delete(svn_wc__db_t *db,
                      const char *local_abspath,
                      const char *moved_to_abspath,
+                     svn_boolean_t delete_dir_externals,
                      svn_skel_t *conflict,
                      svn_skel_t *work_items,
                      svn_cancel_func_t cancel_func,
@@ -1498,6 +1503,10 @@ svn_wc__db_op_delete(svn_wc__db_t *db,
  * It currently lacks support for moves (though this could be changed,
  * at which point svn_wc__db_op_delete() becomes redundant).
  *
+ * This function removes the file externals (and if DELETE_DIR_EXTERNALS is
+ * TRUE also the directory externals) registered below the targets.
+ * (DELETE_DIR_EXTERNALS should be true if also removing unversioned nodes)
+ *
  * If NOTIFY_FUNC is not NULL, then it will be called (with NOTIFY_BATON)
  * for each node deleted. While this processing occurs, if CANCEL_FUNC is
  * not NULL, then it will be called (with CANCEL_BATON) to detect cancellation

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=1361256&r1=1361255&r2=1361256&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Fri Jul 13 15:03:34 2012
@@ -2844,6 +2844,7 @@ do_delete(svn_test__sandbox_t *b,
   SVN_ERR(check_db_rows(b, "", before));
   SVN_ERR(check_db_actual(b, actual_before));
   SVN_ERR(svn_wc__db_op_delete(b->wc_ctx->db, local_abspath, NULL,
+                               TRUE /* delete_dir_externals */,
                                NULL /* conflict */, NULL /* work_item */,
                                NULL, NULL /* cancellation */,
                                NULL, NULL /* notification */,
@@ -3649,8 +3650,6 @@ copy_file_externals(const svn_test_opts_
       { 2, "A/B",   "normal", NO_COPY_FROM },
       { 0, "A/g",   "normal", 1, "f", TRUE },
       { 0, "A/B/g", "normal", 1, "f", TRUE },
-      { 0, "X/g",   "normal", 1, "f", TRUE },
-      { 0, "X/B/g", "normal", 1, "f", TRUE },
       { 0 }
     };
     SVN_ERR(check_db_rows(&b, "", rows));



Mime
View raw message