You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/11/12 18:39:58 UTC

svn commit: r1034490 - in /subversion/trunk/subversion/libsvn_wc: wc-queries.sql wc_db.c

Author: hwright
Date: Fri Nov 12 17:39:57 2010
New Revision: 1034490

URL: http://svn.apache.org/viewvc?rev=1034490&view=rev
Log:
Rewrite another tree-conflict fetching function to take advantage of the
tree conflict storage on victims.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_SELECT_ACTUAL_TREE_CONFLICT): New.

* subversion/libsvn_wc/wc_db.c
  (read_tree_conflicts): Rewrite to avoid fetching all conflicts when we only
    want one.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/libsvn_wc/wc_db.c

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1034490&r1=1034489&r2=1034490&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri Nov 12 17:39:57 2010
@@ -85,6 +85,11 @@ conflict_working, tree_conflict_data, pr
 FROM actual_node
 WHERE wc_id = ?1 AND local_relpath = ?2;
 
+-- STMT_SELECT_ACTUAL_TREE_CONFLICT
+SELECT conflict_data
+FROM actual_node
+WHERE wc_id = ?1 AND local_relpath = ?2 AND conflict_data IS NOT NULL;
+
 -- STMT_SELECT_NODE_CHILDREN_INFO
 /* Getting rows in an advantageous order using
      ORDER BY local_relpath, op_depth DESC

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1034490&r1=1034489&r2=1034490&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Nov 12 17:39:57 2010
@@ -4340,24 +4340,29 @@ read_tree_conflict(const svn_wc_conflict
                    apr_pool_t *result_pool,
                    apr_pool_t *scratch_pool)
 {
-  if (local_relpath[0])
-    {
-      const char *parent_relpath;
-      apr_hash_t *tree_conflicts;
+  svn_sqlite__stmt_t *stmt;
+  svn_boolean_t have_row;
+  const char *conflict_data;
+  const svn_skel_t *skel;
+  
+  *tree_conflict = NULL;
 
-      parent_relpath = svn_dirent_dirname(local_relpath, scratch_pool);
+  if (!local_relpath[0])
+    return SVN_NO_ERROR;
 
-      SVN_ERR(read_all_tree_conflicts(&tree_conflicts, pdh, parent_relpath,
-                                      result_pool, scratch_pool));
-      if (tree_conflicts)
-        *tree_conflict = apr_hash_get(tree_conflicts,
-                                      svn_dirent_basename(local_relpath, NULL),
-                                      APR_HASH_KEY_STRING);
-      else
-        *tree_conflict = NULL;
-    }
-  else
-    *tree_conflict = NULL;
+  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+                                    STMT_SELECT_ACTUAL_TREE_CONFLICT));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__step(&have_row, stmt));
+
+  if (!have_row)
+    return SVN_NO_ERROR;
+
+  conflict_data = svn_sqlite__column_text(stmt, 0, NULL);
+  skel = svn_skel__parse(conflict_data, strlen(conflict_data), scratch_pool);
+  SVN_ERR(svn_wc__deserialize_conflict(tree_conflict, skel,
+                                       pdh->wcroot->abspath, result_pool,
+                                       scratch_pool));
 
   return SVN_NO_ERROR;
 }