You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2011/05/27 18:46:34 UTC

svn commit: r1128389 - in /subversion/trunk/subversion: libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c tests/cmdline/revert_tests.py

Author: philip
Date: Fri May 27 16:46:34 2011
New Revision: 1128389

URL: http://svn.apache.org/viewvc?rev=1128389&view=rev
Log:
Fix issue 3859 by extending the revert list table to allow
both an ACTUAL_NODE and a NODES row to be recorded.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_CREATE_REVERT_LIST): Add actual column to revert_list table and
   make it part of the primary key, set the actual column when adding
   rows.
  (STMT_SELECT_REVERT_LIST): Select, and order by, actual column.
  (STMT_SELECT_REVERT_LIST_RECURSIVE): Select distinct local_relpaths
   that require notification.

* subversion/libsvn_wc/wc_db.c
  (revert_list_read): Handle getting up to two rows per path.
  (svn_wc__db_revert_list_notify): Always notify since selection is
   done in SQL.

* subversion/tests/cmdline/revert_tests.py
  (revert_empty_actual_recursive, revert_no_text_change_conflict): Remove
   XFAIL markers.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/tests/cmdline/revert_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1128389&r1=1128388&r2=1128389&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri May 27 16:46:34 2011
@@ -1047,28 +1047,31 @@ DROP TABLE IF EXISTS temp__node_props_ca
 -- STMT_CREATE_REVERT_LIST
 DROP TABLE IF EXISTS revert_list;
 CREATE TEMPORARY TABLE revert_list (
-   local_relpath TEXT PRIMARY KEY,
+   /* need wc_id if/when revert spans multiple working copies */
+   local_relpath TEXT,
+   actual INTEGER,         /* 1 if an actual row, 0 if a nodes row */
    conflict_old TEXT,
    conflict_new TEXT,
    conflict_working TEXT,
    prop_reject TEXT,
-   notify INTEGER
+   notify INTEGER,         /* 1 if an actual row had props or tree conflict */
+   PRIMARY KEY (local_relpath, actual)
    );
 DROP TRIGGER IF EXISTS   trigger_revert_list_nodes;
 CREATE TEMPORARY TRIGGER trigger_revert_list_nodes
 BEFORE DELETE ON nodes
 BEGIN
-   INSERT OR REPLACE INTO revert_list(local_relpath, notify)
-   SELECT OLD.local_relpath, 1;
+   INSERT OR REPLACE INTO revert_list(local_relpath, actual)
+   SELECT OLD.local_relpath, 0;
 END;
 DROP TRIGGER IF EXISTS   trigger_revert_list_actual_delete;
 CREATE TEMPORARY TRIGGER trigger_revert_list_actual_delete
 BEFORE DELETE ON actual_node
 BEGIN
-   INSERT OR REPLACE INTO revert_list(local_relpath, conflict_old,
+   INSERT OR REPLACE INTO revert_list(local_relpath, actual, conflict_old,
                                        conflict_new, conflict_working,
                                        prop_reject, notify)
-   SELECT OLD.local_relpath,
+   SELECT OLD.local_relpath, 1,
           OLD.conflict_old, OLD.conflict_new, OLD.conflict_working,
           OLD.prop_reject,
           CASE
@@ -1079,10 +1082,10 @@ DROP TRIGGER IF EXISTS   trigger_revert_
 CREATE TEMPORARY TRIGGER trigger_revert_list_actual_update
 BEFORE UPDATE ON actual_node
 BEGIN
-   INSERT OR REPLACE INTO revert_list(local_relpath, conflict_old,
+   INSERT OR REPLACE INTO revert_list(local_relpath, actual, conflict_old,
                                        conflict_new, conflict_working,
                                        prop_reject, notify)
-   SELECT OLD.local_relpath,
+   SELECT OLD.local_relpath, 1,
           OLD.conflict_old, OLD.conflict_new, OLD.conflict_working,
           OLD.prop_reject,
           CASE
@@ -1096,17 +1099,19 @@ DROP TRIGGER IF EXISTS trigger_revert_li
 DROP TRIGGER IF EXISTS trigger_revert_list_actual_update
 
 -- STMT_SELECT_REVERT_LIST
-SELECT conflict_old, conflict_new, conflict_working, prop_reject, notify
+SELECT conflict_old, conflict_new, conflict_working, prop_reject, notify, actual
 FROM revert_list
 WHERE local_relpath = ?1
+ORDER BY actual DESC
 
 -- STMT_DELETE_REVERT_LIST
 DELETE FROM revert_list WHERE local_relpath = ?1
 
 -- STMT_SELECT_REVERT_LIST_RECURSIVE
-SELECT local_relpath, notify
+SELECT DISTINCT local_relpath
 FROM revert_list
-WHERE local_relpath = ?1 or local_relpath LIKE ?2 ESCAPE '#'
+WHERE (local_relpath = ?1 OR local_relpath LIKE ?2 ESCAPE '#')
+  AND (notify OR actual = 0)
 ORDER BY local_relpath
 
 -- STMT_DELETE_REVERT_LIST_RECURSIVE

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1128389&r1=1128388&r2=1128389&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri May 27 16:46:34 2011
@@ -5470,48 +5470,53 @@ revert_list_read(void *baton,
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
 
+  *(b->reverted) = FALSE;
+  *(b->conflict_new) = *(b->conflict_old) = *(b->conflict_working) = NULL;
+  *(b->prop_reject) = NULL;
+
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_SELECT_REVERT_LIST));
   SVN_ERR(svn_sqlite__bindf(stmt, "s", local_relpath));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
   if (have_row)
     {
-      *(b->reverted) = !svn_sqlite__column_is_null(stmt, 4);
-      if (svn_sqlite__column_is_null(stmt, 0))
-        *(b->conflict_new) = NULL;
-      else
-        *(b->conflict_new) = svn_dirent_join(wcroot->abspath,
-                                             svn_sqlite__column_text(stmt, 0,
-                                                                     NULL),
-                                             b->result_pool);
-      if (svn_sqlite__column_is_null(stmt, 1))
-        *(b->conflict_old) = NULL;
-      else
-        *(b->conflict_old) = svn_dirent_join(wcroot->abspath,
-                                             svn_sqlite__column_text(stmt, 1,
-                                                                     NULL),
-                                             b->result_pool);
-      if (svn_sqlite__column_is_null(stmt, 2))
-        *(b->conflict_working) = NULL;
-      else
-        *(b->conflict_working) = svn_dirent_join(wcroot->abspath,
-                                                 svn_sqlite__column_text(stmt,
-                                                                         2,
-                                                                         NULL),
-                                                 b->result_pool);
-      if (svn_sqlite__column_is_null(stmt, 3))
-        *(b->prop_reject) = NULL;
+      svn_boolean_t another_row;
+
+      if (svn_sqlite__column_int64(stmt, 5))
+        {
+          if (!svn_sqlite__column_is_null(stmt, 4))
+            *(b->reverted) = TRUE;
+        
+          if (!svn_sqlite__column_is_null(stmt, 0))
+            *(b->conflict_new)
+              = svn_dirent_join(wcroot->abspath,
+                                svn_sqlite__column_text(stmt, 0, NULL),
+                                b->result_pool);
+
+          if (!svn_sqlite__column_is_null(stmt, 1))
+            *(b->conflict_old)
+              = svn_dirent_join(wcroot->abspath,
+                                svn_sqlite__column_text(stmt, 1, NULL),
+                                b->result_pool);
+
+          if (!svn_sqlite__column_is_null(stmt, 2))
+            *(b->conflict_working)
+              = svn_dirent_join(wcroot->abspath,
+                                svn_sqlite__column_text(stmt, 2, NULL),
+                                b->result_pool);
+
+          if (!svn_sqlite__column_is_null(stmt, 3))
+            *(b->prop_reject)
+              = svn_dirent_join(wcroot->abspath,
+                                svn_sqlite__column_text(stmt, 3, NULL),
+                                b->result_pool);
+
+          SVN_ERR(svn_sqlite__step(&another_row, stmt));
+          if (another_row)
+            *(b->reverted) = TRUE;
+        }
       else
-        *(b->prop_reject) = svn_dirent_join(wcroot->abspath,
-                                            svn_sqlite__column_text(stmt, 3,
-                                                                    NULL),
-                                            b->result_pool);
-    }
-  else
-    {
-      *(b->reverted) = FALSE;
-      *(b->conflict_new) = *(b->conflict_old) = *(b->conflict_working) = NULL;
-      *(b->prop_reject) = NULL;
+        *(b->reverted) = TRUE;
     }
   SVN_ERR(svn_sqlite__reset(stmt));
 
@@ -5583,19 +5588,14 @@ svn_wc__db_revert_list_notify(svn_wc_not
 
       svn_pool_clear(iterpool);
 
-      if (svn_sqlite__column_int64(stmt, 1))
-        {
-          const char *notify_abspath = svn_dirent_join(wcroot->abspath,
+      notify_func(notify_baton,
+                  svn_wc_create_notify(svn_dirent_join(wcroot->abspath,
                                                        notify_relpath,
-                                                       iterpool);
-          notify_func(notify_baton,
-                      svn_wc_create_notify(notify_abspath,
-                                           svn_wc_notify_revert,
-                                           iterpool),
-                      iterpool);
+                                                       iterpool),
+                                       svn_wc_notify_revert,
+                                       iterpool),
+                  iterpool);
 
-          /* ### Need cancel_func? */
-        }
       SVN_ERR(svn_sqlite__step(&have_row, stmt));
     }
   SVN_ERR(svn_sqlite__reset(stmt));

Modified: subversion/trunk/subversion/tests/cmdline/revert_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/revert_tests.py?rev=1128389&r1=1128388&r2=1128389&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/revert_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/revert_tests.py Fri May 27 16:46:34 2011
@@ -1299,7 +1299,6 @@ def create_superflous_actual_node(sbox):
   expected_status.tweak('alpha', status='A ')
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
-@XFail()
 @Issue(3859)
 def revert_empty_actual(sbox):
   "revert with superfluous actual node"
@@ -1316,7 +1315,6 @@ def revert_empty_actual(sbox):
   expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
-@XFail()
 @Issue(3859)
 def revert_empty_actual_recursive(sbox):
   "recusive revert with superfluous actual node"