Author: rhuijben
Date: Fri Feb 20 16:54:25 2015
New Revision: 1661160
URL: http://svn.apache.org/r1661160
Log:
Following up on r1661143, use even more free sqlite power:
ask sqlite to provide sorted and unique results for the children
queries that could provide multiple results.
Sqlite can do this for +- free, because all of that is stored
in the index it should use.
(The wc-queries test would provide an error if it used
intermediate storage for its calculations)
Verified with Sqlite 3.7, 3.8 (and by our wc-queries tests)
* subversion/libsvn_wc/wc-queries.sql
(STMT_SELECT_NODE_CHILDREN,
STMT_SELECT_WORKING_CHILDREN): Add DISTINCT and ORDER BY, to
guarantee stable results.
* subversion/libsvn_wc/wc_db.c
(gather_children): Remove now unneeded duplicate filtering.
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=1661160&r1=1661159&r2=1661160&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri Feb 20 16:54:25
2015
@@ -401,15 +401,16 @@ 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)
@@ -417,6 +418,7 @@ WHERE wc_id = ?1 AND parent_relpath = ?2
(op_depth = (SELECT MAX(op_depth) FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2)
AND presence != MAP_BASE_DELETED))
+ORDER BY local_relpath
-- STMT_SELECT_NODE_PROPS
SELECT properties, presence FROM nodes
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1661160&r1=1661159&r2=1661160&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Feb 20 16:54:25 2015
@@ -1167,7 +1167,6 @@ gather_children(const apr_array_header_t
apr_array_header_t *result;
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
- const char *last_name = NULL;
result = apr_array_make(result_pool, 16, sizeof(const char*));
@@ -1182,14 +1181,7 @@ gather_children(const apr_array_header_t
const char *child_relpath = svn_sqlite__column_text(stmt, 0, NULL);
const char *name = svn_relpath_basename(child_relpath, result_pool);
- if (op_depth < 0)
- {
- /* Remove possible duplicates */
- if (!last_name || strcmp(last_name, name) != 0)
- APR_ARRAY_PUSH(result, const char *) = last_name = name;
- }
- else
- APR_ARRAY_PUSH(result, const char *) = name;
+ APR_ARRAY_PUSH(result, const char *) = name;
SVN_ERR(svn_sqlite__step(&have_row, stmt));
}