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

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

Author: gstein
Date: Thu May 19 16:31:26 2011
New Revision: 1124991

URL: http://svn.apache.org/viewvc?rev=1124991&view=rev
Log:
Fix issue 3859: we missed providing a notification in certain situations.

Specifically, the triggers were marking rows in the 'revert_list' but were
working against each other. This change removes the triggers from one set
of code paths and manually inserts the appropriate rows.

There is more cleanup on this code path, and the "recursive revert" code
paths can (and should?) be switched away from triggers. But that work is
for a future revision.

* subversion/tests/cmdline/revert_tests.py:
  (revert_empty_actual): remove the XFail decorator

* subversion/libsvn_wc/wc-queries.sql:
  (STMT_INSERT_REVERT_LIST): insert an item into revert_list, picking up
    conflict information from the ACTUAL_NODE, if any
  (STMT_INSERT_REVERT_LIST_PLAIN): just jam a simple row in there
  (STMT_INSERT_REVERT_LIST_ACTUAL_ONLY): insert a row based on any
    available information from ACTUAL_NODE

* subversion/libsvn_wc/wc_db.c:
  (op_revert_txn): drop the triggers on entry. we don't want to use them.
    we'll just avoid the triggers in the future. for each appropriate
    condition of what we find in the tables, insert an appropriate row
    into the revert_list.

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=1124991&r1=1124990&r2=1124991&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Thu May 19 16:31:26 2011
@@ -1054,6 +1054,7 @@ DROP TABLE IF EXISTS temp__node_props_ca
 -- STMT_CREATE_REVERT_LIST
 DROP TABLE IF EXISTS revert_list;
 CREATE TEMPORARY TABLE revert_list (
+   /* ### need wc_id  */
    local_relpath TEXT PRIMARY KEY,
    conflict_old TEXT,
    conflict_new TEXT,
@@ -1097,6 +1098,30 @@ BEGIN
           THEN 1 ELSE NULL END;
 END
 
+-- STMT_INSERT_REVERT_LIST
+INSERT OR REPLACE INTO revert_list(local_relpath, notify, conflict_old,
+                                   conflict_new, conflict_working, prop_reject)
+SELECT nodes.local_relpath, 1,
+       conflict_old, conflict_new, conflict_working, prop_reject
+FROM nodes
+LEFT OUTER JOIN actual_node
+ON    nodes.wc_id = ?1       AND nodes.local_relpath = ?2
+  AND actual_node.wc_id = ?1 AND actual_node.local_relpath = ?2
+WHERE nodes.wc_id = ?1       AND nodes.local_relpath = ?2
+
+-- STMT_INSERT_REVERT_LIST_PLAIN
+INSERT OR REPLACE INTO revert_list(local_relpath, notify)
+VALUES (?1, 1)
+
+-- STMT_INSERT_REVERT_LIST_ACTUAL_ONLY
+INSERT OR REPLACE INTO revert_list(local_relpath, notify, conflict_old,
+                                   conflict_new, conflict_working, prop_reject)
+SELECT local_relpath, 1,
+       conflict_old, conflict_new, conflict_working, prop_reject
+FROM actual_node
+WHERE wc_id = ?1 AND local_relpath = ?2
+  AND (properties IS NOT NULL OR tree_conflict_data IS NOT NULL)
+
 -- STMT_DROP_REVERT_LIST_TRIGGERS
 DROP TRIGGER IF EXISTS trigger_revert_list_nodes;
 DROP TRIGGER IF EXISTS trigger_revert_list_actual_delete;

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1124991&r1=1124990&r2=1124991&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu May 19 16:31:26 2011
@@ -5127,6 +5127,10 @@ op_revert_txn(void *baton,
   apr_int64_t op_depth;
   int affected_rows;
 
+  /* ### we shouldn't create the triggers in the first place. next round.  */
+  SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb,
+                                      STMT_DROP_REVERT_LIST_TRIGGERS));
+
   /* ### Similar structure to op_revert_recursive_txn, should they be
          combined? */
 
@@ -5159,6 +5163,17 @@ op_revert_txn(void *baton,
                                      path_for_error_message(wcroot,
                                                             local_relpath,
                                                             scratch_pool));
+
+          /* The node exists purely as an ACTUAL_NODE. Thus, it is a
+             delete-delete tree-conflicted node. There are no conflict
+             files to extract from the row, but we DO want to notify
+             about this node. Insert an appropriate row.  */
+          SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                            STMT_INSERT_REVERT_LIST_PLAIN));
+          /* ### we should be binding wc_id  */
+          SVN_ERR(svn_sqlite__bindf(stmt, "s", local_relpath));
+          SVN_ERR(svn_sqlite__step_done(stmt));
+
           return SVN_NO_ERROR;
         }
 
@@ -5174,6 +5189,13 @@ op_revert_txn(void *baton,
 
   if (op_depth > 0 && op_depth == relpath_depth(local_relpath))
     {
+      /* A NODES row is present, so leave a row in the REVERT_LIST table.
+         This will gather data from ACTUAL_NODE, if a row is available.  */
+      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                        STMT_INSERT_REVERT_LIST));
+      SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+      SVN_ERR(svn_sqlite__step_done(stmt));
+
       /* Can't do non-recursive revert if children exist */
       SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                         STMT_SELECT_GE_OP_DEPTH_CHILDREN));
@@ -5210,6 +5232,17 @@ op_revert_txn(void *baton,
       SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
       SVN_ERR(svn_sqlite__step_done(stmt));
     }
+  else
+    {
+      /* We have a BASE node (or we're looking at a child of an op-root),
+         but we still want to insert into REVERT_LIST because we MAY be
+         about to revert some changes on ACTUAL_NODE only. Investigate
+         the ACTUAL_NODE row, and insert into REVERT_LIST as appropriate.  */
+      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                        STMT_INSERT_REVERT_LIST_ACTUAL_ONLY));
+      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,
                                   STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST));

Modified: subversion/trunk/subversion/tests/cmdline/revert_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/revert_tests.py?rev=1124991&r1=1124990&r2=1124991&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/revert_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/revert_tests.py Thu May 19 16:31:26 2011
@@ -1261,7 +1261,7 @@ def revert_nested_add_depth_immediates(s
   expected_status.remove('A/X', 'A/X/Y')
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
-@XFail()
+
 @Issue(3859)
 def revert_empty_actual(sbox):
   "revert with superfluous actual node"