Modified: subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc-queries.sql URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc-queries.sql?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc-queries.sql (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc-queries.sql Wed Feb 25 08:15:39 2015 @@ -156,6 +156,7 @@ ORDER BY local_relpath DESC SELECT local_relpath, op_depth, presence, kind FROM nodes_current WHERE wc_id = ?1 AND parent_relpath = ?2 +ORDER BY local_relpath -- STMT_SELECT_ACTUAL_CHILDREN_INFO SELECT local_relpath, changelist, properties, conflict_data @@ -184,16 +185,6 @@ INSERT OR REPLACE INTO nodes ( VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16, ?17, ?18, ?19, ?20, ?21, ?22, ?23) --- STMT_SELECT_BASE_PRESENT -SELECT local_relpath, kind FROM nodes n -WHERE wc_id = ?1 AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2) - AND op_depth = 0 - AND presence in (MAP_NORMAL, MAP_INCOMPLETE) - AND NOT EXISTS(SELECT 1 FROM NODES w - WHERE w.wc_id = ?1 AND w.local_relpath = n.local_relpath - AND op_depth > 0) -ORDER BY local_relpath DESC - -- STMT_SELECT_WORKING_PRESENT SELECT local_relpath, kind, checksum, translated_size, last_mod_time FROM nodes n @@ -233,6 +224,16 @@ WHERE wc_id = ?1 AND IS_STRICT_DESCENDAN -- STMT_DELETE_WORKING_BASE_DELETE DELETE FROM nodes +WHERE wc_id = ?1 AND local_relpath = ?2 + AND presence = MAP_BASE_DELETED + AND op_depth > ?3 + AND op_depth = (SELECT MIN(op_depth) FROM nodes n + WHERE n.wc_id = ?1 + AND n.local_relpath = nodes.local_relpath + AND op_depth > ?3) + +-- STMT_DELETE_WORKING_BASE_DELETE_RECURSIVE +DELETE FROM nodes WHERE wc_id = ?1 AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2) AND presence = MAP_BASE_DELETED AND op_depth > ?3 @@ -253,7 +254,7 @@ WHERE wc_id = ?1 AND IS_STRICT_DESCENDAN -- STMT_DELETE_WORKING_OP_DEPTH DELETE FROM nodes -WHERE wc_id = ?1 +WHERE wc_id = ?1 AND (local_relpath = ?2 OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2)) AND op_depth = ?3 @@ -262,15 +263,12 @@ The op_root must exist (or there is no l always has presence 'normal' */ -- STMT_SELECT_LAYER_FOR_REPLACE SELECT s.local_relpath, s.kind, - RELPATH_SKIP_JOIN(?2, ?4, s.local_relpath) drp, 'normal', 0 + RELPATH_SKIP_JOIN(?2, ?4, s.local_relpath) drp, 'normal' FROM nodes s WHERE s.wc_id = ?1 AND s.local_relpath = ?2 AND s.op_depth = ?3 UNION ALL SELECT s.local_relpath, s.kind, - RELPATH_SKIP_JOIN(?2, ?4, s.local_relpath) drp, d.presence, - EXISTS(SELECT * FROM nodes sh - WHERE sh.wc_id = ?1 AND sh.op_depth > ?5 - AND sh.local_relpath = d.local_relpath) shadowed + RELPATH_SKIP_JOIN(?2, ?4, s.local_relpath) drp, d.presence FROM nodes s LEFT OUTER JOIN nodes d ON d.wc_id= ?1 AND d.op_depth = ?5 AND d.local_relpath = drp @@ -295,17 +293,16 @@ INSERT OR REPLACE INTO nodes ( changed_author, checksum, properties, translated_size, last_mod_time, symlink_target, moved_here, moved_to ) SELECT - wc_id, ?4 /*local_relpath */, ?5 /*op_depth*/, ?6 /* parent_relpath */, - repos_id, - repos_path, revision, presence, depth, kind, changed_revision, - changed_date, changed_author, checksum, properties, translated_size, - last_mod_time, symlink_target, 1, - (SELECT dst.moved_to FROM nodes AS dst - WHERE dst.wc_id = ?1 - AND dst.local_relpath = ?4 - AND dst.op_depth = ?5) -FROM nodes -WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3 + s.wc_id, ?4 /*local_relpath */, ?5 /*op_depth*/, ?6 /* parent_relpath */, + s.repos_id, + s.repos_path, s.revision, s.presence, s.depth, s.kind, s.changed_revision, + s.changed_date, s.changed_author, s.checksum, s.properties, + CASE WHEN d.checksum=s.checksum THEN d.translated_size END, + CASE WHEN d.checksum=s.checksum THEN d.last_mod_time END, + s.symlink_target, 1, d.moved_to +FROM nodes s +LEFT JOIN nodes d ON d.wc_id=?1 AND d.local_relpath=?4 AND d.op_depth=?5 +WHERE s.wc_id = ?1 AND s.local_relpath = ?2 AND s.op_depth = ?3 -- STMT_SELECT_NO_LONGER_MOVED_RV SELECT d.local_relpath, RELPATH_SKIP_JOIN(?2, ?4, d.local_relpath) srp, @@ -327,7 +324,7 @@ ORDER BY d.local_relpath DESC -- STMT_SELECT_OP_DEPTH_CHILDREN SELECT local_relpath, kind FROM nodes -WHERE wc_id = ?1 +WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth = ?3 AND presence != MAP_BASE_DELETED @@ -336,7 +333,7 @@ ORDER BY local_relpath -- STMT_SELECT_OP_DEPTH_CHILDREN_EXISTS SELECT local_relpath, kind FROM nodes -WHERE wc_id = ?1 +WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth = ?3 AND presence IN (MAP_NORMAL, MAP_INCOMPLETE) @@ -348,7 +345,8 @@ ORDER BY local_relpath -- STMT_SELECT_GE_OP_DEPTH_CHILDREN SELECT 1 FROM nodes WHERE wc_id = ?1 AND parent_relpath = ?2 - AND (op_depth > ?3 OR (op_depth = ?3 AND presence != MAP_BASE_DELETED)) + AND (op_depth > ?3 OR (op_depth = ?3 + AND presence IN (MAP_NORMAL, MAP_INCOMPLETE))) UNION ALL SELECT 1 FROM ACTUAL_NODE a WHERE wc_id = ?1 AND parent_relpath = ?2 @@ -382,6 +380,7 @@ UPDATE NODES SET op_depth = 0, revision = ?6, dav_cache = NULL, moved_here = NULL, + moved_to = NULL, presence = CASE presence WHEN MAP_NORMAL THEN MAP_NORMAL WHEN MAP_EXCLUDED THEN MAP_EXCLUDED @@ -394,22 +393,30 @@ WHERE wc_id = ?1 -- STMT_SELECT_NODE_CHILDREN /* Return all paths that are children of the directory (?1, ?2) in any op-depth, including children of any underlying, replaced directories. */ -SELECT local_relpath FROM nodes +SELECT DISTINCT local_relpath FROM nodes WHERE wc_id = ?1 AND parent_relpath = ?2 +ORDER BY local_relpath -- STMT_SELECT_WORKING_CHILDREN /* Return all paths that are children of the working version of the directory (?1, ?2). A given path is not included just because it is a child of an underlying (replaced) directory, it has to be in the working version of the directory. */ -SELECT local_relpath FROM nodes +SELECT DISTINCT local_relpath FROM nodes WHERE wc_id = ?1 AND parent_relpath = ?2 AND (op_depth > (SELECT MAX(op_depth) FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2) OR (op_depth = (SELECT MAX(op_depth) FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2) - AND presence != MAP_BASE_DELETED)) + AND presence IN (MAP_NORMAL, MAP_INCOMPLETE))) +ORDER BY local_relpath + +-- STMT_SELECT_BASE_NOT_PRESENT_CHILDREN +SELECT local_relpath FROM nodes +WHERE wc_id = ?1 AND parent_relpath = ?2 AND op_depth = 0 + AND presence = MAP_NOT_PRESENT +ORDER BY local_relpath -- STMT_SELECT_NODE_PROPS SELECT properties, presence FROM nodes @@ -456,25 +463,13 @@ SELECT dav_cache FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 -- STMT_SELECT_DELETION_INFO -SELECT (SELECT b.presence FROM nodes AS b - WHERE b.wc_id = ?1 AND b.local_relpath = ?2 AND b.op_depth = 0), - work.presence, work.op_depth -FROM nodes_current AS work -WHERE work.wc_id = ?1 AND work.local_relpath = ?2 AND work.op_depth > 0 -LIMIT 1 - --- STMT_SELECT_DELETION_INFO_SCAN -/* ### FIXME. moved.moved_to IS NOT NULL works when there is - only one move but we need something else when there are several. */ -SELECT (SELECT b.presence FROM nodes AS b - WHERE b.wc_id = ?1 AND b.local_relpath = ?2 AND b.op_depth = 0), - work.presence, work.op_depth, moved.moved_to -FROM nodes_current AS work -LEFT OUTER JOIN nodes AS moved - ON moved.wc_id = work.wc_id - AND moved.local_relpath = work.local_relpath - AND moved.moved_to IS NOT NULL -WHERE work.wc_id = ?1 AND work.local_relpath = ?2 AND work.op_depth > 0 +SELECT b.presence, w.presence, w.op_depth, w.moved_to +FROM nodes w +LEFT JOIN nodes b ON b.wc_id = ?1 AND b.local_relpath = ?2 AND b.op_depth = 0 +WHERE w.wc_id = ?1 AND w.local_relpath = ?2 + AND w.op_depth = (SELECT MAX(op_depth) FROM nodes d + WHERE d.wc_id = ?1 AND d.local_relpath = ?2 + AND d.op_depth > 0) LIMIT 1 -- STMT_SELECT_MOVED_TO_NODE @@ -547,7 +542,7 @@ UPDATE nodes SET repos_id = ?4, dav_cach WHERE (wc_id = ?1 AND local_relpath = ?2 AND repos_id = ?3) OR (wc_id = ?1 AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2) AND repos_id = ?3) - + -- STMT_UPDATE_LOCK_REPOS_ID UPDATE lock SET repos_id = ?2 @@ -726,6 +721,13 @@ INSERT OR IGNORE INTO actual_node ( SELECT wc_id, local_relpath, parent_relpath FROM targets_list +-- STMT_INSERT_ACTUAL_EMPTIES_FILES +INSERT OR IGNORE INTO actual_node ( + wc_id, local_relpath, parent_relpath) +SELECT wc_id, local_relpath, parent_relpath +FROM targets_list +WHERE kind=MAP_FILE + -- STMT_DELETE_ACTUAL_EMPTY DELETE FROM actual_node WHERE wc_id = ?1 AND local_relpath = ?2 @@ -740,7 +742,7 @@ WHERE wc_id = ?1 AND local_relpath = ?2 -- STMT_DELETE_ACTUAL_EMPTIES DELETE FROM actual_node WHERE wc_id = ?1 - AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2) + AND (local_relpath = ?2 OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2)) AND properties IS NULL AND conflict_data IS NULL AND changelist IS NULL @@ -804,7 +806,7 @@ WHERE wc_id = ?1 OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2)) AND (changelist IS NULL OR NOT EXISTS (SELECT 1 FROM nodes_current c - WHERE c.wc_id = ?1 + WHERE c.wc_id = ?1 AND c.local_relpath = actual_node.local_relpath AND c.kind = MAP_FILE)) @@ -819,6 +821,17 @@ SET properties = NULL, right_checksum = NULL WHERE wc_id = ?1 AND local_relpath = ?2 +-- STMT_CLEAR_ACTUAL_NODE_LEAVING_CONFLICT +UPDATE actual_node +SET properties = NULL, + text_mod = NULL, + tree_conflict_data = NULL, + older_checksum = NULL, + left_checksum = NULL, + right_checksum = NULL, + changelist = NULL +WHERE wc_id = ?1 AND local_relpath = ?2 + -- STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE UPDATE actual_node SET properties = NULL, @@ -836,6 +849,7 @@ WHERE wc_id = ?1 UPDATE nodes SET depth = ?3 WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 AND kind=MAP_DIR + AND presence IN (MAP_NORMAL, MAP_INCOMPLETE) -- STMT_UPDATE_NODE_BASE_PRESENCE UPDATE nodes SET presence = ?3 @@ -1009,15 +1023,17 @@ WHERE wc_id = ?1 ORDER BY local_relpath -- STMT_INSERT_WORKING_NODE_FROM_BASE_COPY -INSERT INTO nodes ( +INSERT OR REPLACE INTO nodes ( wc_id, local_relpath, op_depth, parent_relpath, repos_id, repos_path, revision, presence, depth, kind, changed_revision, changed_date, changed_author, checksum, properties, translated_size, last_mod_time, - symlink_target ) + symlink_target, moved_to ) SELECT wc_id, local_relpath, ?3 /*op_depth*/, parent_relpath, repos_id, repos_path, revision, presence, depth, kind, changed_revision, changed_date, changed_author, checksum, properties, translated_size, - last_mod_time, symlink_target + last_mod_time, symlink_target, + (SELECT moved_to FROM nodes + WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3) moved_to FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0 @@ -1566,16 +1582,6 @@ WHERE wc_id = ?1 AND repos_path IS NOT RELPATH_SKIP_JOIN(?2, ?3, local_relpath) LIMIT 1 --- STMT_SELECT_BASE_FILES_RECURSIVE -SELECT local_relpath, translated_size, last_mod_time FROM nodes AS n -WHERE wc_id = ?1 - AND (local_relpath = ?2 - OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2)) - AND op_depth = 0 - AND kind=MAP_FILE - AND presence=MAP_NORMAL - AND file_external IS NULL - -- STMT_SELECT_MOVED_FROM_RELPATH SELECT local_relpath, op_depth FROM nodes WHERE wc_id = ?1 AND moved_to = ?2 AND op_depth > 0 @@ -1671,26 +1677,6 @@ WHERE wc_id = ?1 AND moved_to IS NOT NULL AND NOT IS_STRICT_DESCENDANT_OF(moved_to, ?2) -/* This statement is very similar to STMT_SELECT_MOVED_DESCENDANTS_SRC - but the passed op-depth is the depth of the shadowing node. - - This version is slightly more efficient as the most inner query is - only executed once, but the Sqlite page cache makes the difference - not really measurable */ --- STMT_SELECT_MOVED_DESCENDANTS_SHD -SELECT n.op_depth, n.local_relpath, n.kind, n.repos_path, s.moved_to -FROM nodes s -JOIN nodes n ON n.wc_id = ?1 AND n.local_relpath = s.local_relpath - AND n.op_depth=(SELECT MAX(d.op_depth) - FROM nodes d - WHERE d.wc_id = ?1 AND d.local_relpath = ?2 - AND d.op_depth < ?3) -WHERE s.wc_id = ?1 AND s.op_depth = ?3 - AND IS_STRICT_DESCENDANT_OF(s.local_relpath, ?2) - AND s.moved_to IS NOT NULL - -/* This statement is very similar to STMT_SELECT_MOVED_DESCENDANTS_SHD, - but the passed op-depth is the depth of the node as it originally existed */ -- STMT_SELECT_MOVED_DESCENDANTS_SRC SELECT s.op_depth, n.local_relpath, n.kind, n.repos_path, s.moved_to FROM nodes n @@ -1701,7 +1687,7 @@ JOIN nodes s ON s.wc_id = n.wc_id AND s. AND d.local_relpath = s.local_relpath AND d.op_depth > ?3) WHERE n.wc_id = ?1 AND n.op_depth = ?3 - AND IS_STRICT_DESCENDANT_OF(n.local_relpath, ?2) + AND (n.local_relpath = ?2 OR IS_STRICT_DESCENDANT_OF(n.local_relpath, ?2)) AND s.moved_to IS NOT NULL -- STMT_COMMIT_UPDATE_ORIGIN
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc.h URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc.h?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc.h (original) +++ subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc.h Wed Feb 25 08:15:39 2015 @@ -158,7 +158,7 @@ extern "C" { * Bumped in r1395109. * * == 1.8.x shipped with format 31 - * + * * Please document any further format changes here. */ @@ -577,17 +577,6 @@ svn_wc__internal_get_origin(svn_boolean_ apr_pool_t *result_pool, apr_pool_t *scratch_pool); -/* Internal version of svn_wc__node_get_repos_info() */ -svn_error_t * -svn_wc__internal_get_repos_info(svn_revnum_t *revision, - const char **repos_relpath, - const char **repos_root_url, - const char **repos_uuid, - svn_wc__db_t *db, - const char *local_abspath, - apr_pool_t *result_pool, - apr_pool_t *scratch_pool); - /* Upgrade the wc sqlite database given in SDB for the wc located at WCROOT_ABSPATH. It's current/starting format is given by START_FORMAT. After the upgrade is complete (to as far as the automatic upgrade will @@ -733,6 +722,7 @@ svn_wc__node_has_local_mods(svn_boolean_ svn_boolean_t *all_edits_are_deletes, svn_wc__db_t *db, const char *local_abspath, + svn_boolean_t ignore_unversioned, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *scratch_pool);
