You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2012/05/22 08:34:06 UTC
svn commit: r1341317 - in /subversion/trunk/subversion:
include/private/svn_wc_private.h libsvn_client/merge.c libsvn_wc/node.c
libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c libsvn_wc/wc_db.h
tests/libsvn_wc/wc-queries-test.c
Author: rhuijben
Date: Tue May 22 06:34:06 2012
New Revision: 1341317
URL: http://svn.apache.org/viewvc?rev=1341317&view=rev
Log:
Fix a hidden bug in the merge handling and a slow wc.db query.
* subversion/include/private/svn_wc_private.h
(svn_wc__get_server_excluded_subtrees): Rename to ...
(svn_wc__get_excluded_subtrees): ... this. Update documentaton.
* subversion/libsvn_client/merge.c
(get_mergeinfo_paths): Update caller, that really just needs a list
of paths that are not there.
* subversion/libsvn_wc/node.c
(svn_wc__get_server_excluded_subtrees): Rename to ...
(svn_wc__get_excluded_subtrees): ... this. Update caller.
* subversion/libsvn_wc/wc-queries.sql
(STMT_SELECT_ALL_EXCLUDED_NODES): Remove selection of node itself and wcroot.
Also select excluded nodes.
(STMT_SELECT_ALL_EXCLUDED_WCROOT): New statement, like
STMT_SELECT_ALL_EXCLUDED_NODES, but specialized to use on the wcroot.
* subversion/libsvn_wc/wc_db.c
(svn_wc__db_get_server_excluded_subtrees): Rename to ...
(svn_wc__db_get_excluded_subtrees): ... this. Use separate new queries.
Don't ask for copying in the scratch pool if we are copying it to
result_pool within its original lifetime
* subversion/libsvn_wc/wc_db.h
(svn_wc__db_get_server_excluded_subtrees): Rename to ...
(svn_wc__db_get_excluded_subtrees): ... this. Update documentaton.
* subversion/tests/libsvn_wc/wc-queries-test.c
(slow_statements): Add STMT_SELECT_ALL_EXCLUDED_WCROOT to the operationg
on the entire wc list. Remove STMT_SELECT_ALL_SERVER_EXCLUDED_NODES as
it properly uses an index instead of a table scan now.
Modified:
subversion/trunk/subversion/include/private/svn_wc_private.h
subversion/trunk/subversion/libsvn_client/merge.c
subversion/trunk/subversion/libsvn_wc/node.c
subversion/trunk/subversion/libsvn_wc/wc-queries.sql
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db.h
subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c
Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1341317&r1=1341316&r2=1341317&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Tue May 22 06:34:06 2012
@@ -993,20 +993,20 @@ svn_wc__has_switched_subtrees(svn_boolea
const char *trail_url,
apr_pool_t *scratch_pool);
-/* Set @a *server_excluded_subtrees to a hash mapping <tt>const char *</tt>
+/* Set @a *excluded_subtrees to a hash mapping <tt>const char *</tt>
* local * absolute paths to <tt>const char *</tt> local absolute paths for
- * every path at or under @a local_abspath in @a wc_ctx which are excluded
- * by the server (e.g. because of authz).
- * If no server-excluded paths are found then @a *server_excluded_subtrees
+ * every path under @a local_abspath in @a wc_ctx which are excluded
+ * by the server (e.g. because of authz) or the users.
+ * If no excluded paths are found then @a *server_excluded_subtrees
* is set to @c NULL.
* Allocate the hash and all items therein from @a result_pool.
*/
svn_error_t *
-svn_wc__get_server_excluded_subtrees(apr_hash_t **server_excluded_subtrees,
- svn_wc_context_t *wc_ctx,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
+svn_wc__get_excluded_subtrees(apr_hash_t **server_excluded_subtrees,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Indicate in @a *is_modified whether the working copy has local
* modifications, using context @a wc_ctx.
Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1341317&r1=1341316&r2=1341317&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Tue May 22 06:34:06 2012
@@ -5795,7 +5795,7 @@ get_mergeinfo_paths(apr_array_header_t *
int i;
apr_pool_t *iterpool = svn_pool_create(scratch_pool);
apr_hash_t *subtrees_with_mergeinfo;
- apr_hash_t *server_excluded_subtrees;
+ apr_hash_t *excluded_subtrees;
apr_hash_t *switched_subtrees;
apr_hash_t *shallow_subtrees;
apr_hash_t *missing_subtrees;
@@ -5970,16 +5970,15 @@ get_mergeinfo_paths(apr_array_header_t *
}
}
- /* Case 6: Paths absent from disk due to server-side exclusion. */
- SVN_ERR(svn_wc__get_server_excluded_subtrees(&server_excluded_subtrees,
- ctx->wc_ctx,
- target->abspath,
- result_pool, scratch_pool));
- if (server_excluded_subtrees)
+ /* Case 6: Paths absent from disk due to server or user exclusion. */
+ SVN_ERR(svn_wc__get_excluded_subtrees(&excluded_subtrees,
+ ctx->wc_ctx, target->abspath,
+ result_pool, scratch_pool));
+ if (excluded_subtrees)
{
apr_hash_index_t *hi;
- for (hi = apr_hash_first(scratch_pool, server_excluded_subtrees);
+ for (hi = apr_hash_first(scratch_pool, excluded_subtrees);
hi;
hi = apr_hash_next(hi))
{
Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1341317&r1=1341316&r2=1341317&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Tue May 22 06:34:06 2012
@@ -1353,18 +1353,18 @@ svn_wc__node_get_lock_tokens_recursive(a
}
svn_error_t *
-svn_wc__get_server_excluded_subtrees(apr_hash_t **server_excluded_subtrees,
- svn_wc_context_t *wc_ctx,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
+svn_wc__get_excluded_subtrees(apr_hash_t **server_excluded_subtrees,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
return svn_error_trace(
- svn_wc__db_get_server_excluded_subtrees(server_excluded_subtrees,
- wc_ctx->db,
- local_abspath,
- result_pool,
- scratch_pool));
+ svn_wc__db_get_excluded_subtrees(server_excluded_subtrees,
+ wc_ctx->db,
+ local_abspath,
+ result_pool,
+ scratch_pool));
}
svn_error_t *
Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1341317&r1=1341316&r2=1341317&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Tue May 22 06:34:06 2012
@@ -925,17 +925,19 @@ WHERE wc_id = ?1
AND op_depth = 0 AND presence = 'absent'
LIMIT 1
+/* Select all excluded nodes. Not valid on the WC-root */
+-- STMT_SELECT_ALL_EXCLUDED_NODES
+SELECT local_relpath FROM nodes
+WHERE wc_id = ?1
+ AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
+ AND op_depth = 0
+ AND (presence = 'absent' OR presence = 'excluded')
-
-/* ### Select all server-excluded nodes. */
--- STMT_SELECT_ALL_SERVER_EXCLUDED_NODES
+-- STMT_SELECT_ALL_EXCLUDED_WCROOT
SELECT local_relpath FROM nodes
WHERE wc_id = ?1
- AND (?2 = ''
- OR local_relpath = ?2
- OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
AND op_depth = 0
- AND presence = 'absent'
+ AND (presence = 'absent' OR presence = 'excluded')
/* Creates a copy from one top level NODE to a different location */
-- STMT_INSERT_WORKING_NODE_COPY_FROM
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1341317&r1=1341316&r2=1341317&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue May 22 06:34:06 2012
@@ -12979,11 +12979,11 @@ svn_wc__db_has_switched_subtrees(svn_boo
}
svn_error_t *
-svn_wc__db_get_server_excluded_subtrees(apr_hash_t **server_excluded_subtrees,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
+svn_wc__db_get_excluded_subtrees(apr_hash_t **excluded_subtrees,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
@@ -12995,25 +12995,35 @@ svn_wc__db_get_server_excluded_subtrees(
db, local_abspath,
scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_SELECT_ALL_SERVER_EXCLUDED_NODES));
- SVN_ERR(svn_sqlite__bindf(stmt, "is",
- wcroot->wc_id,
- local_relpath));
+
+ if (local_relpath[0] == '\0')
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_SELECT_ALL_EXCLUDED_WCROOT));
+ SVN_ERR(svn_sqlite__bind_int64(stmt, 1, wcroot->wc_id));
+ }
+ else
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_SELECT_ALL_EXCLUDED_NODES));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is",
+ wcroot->wc_id,
+ local_relpath));
+ }
SVN_ERR(svn_sqlite__step(&have_row, stmt));
if (have_row)
- *server_excluded_subtrees = apr_hash_make(result_pool);
+ *excluded_subtrees = apr_hash_make(result_pool);
else
- *server_excluded_subtrees = NULL;
+ *excluded_subtrees = NULL;
while (have_row)
{
const char *abs_path =
svn_dirent_join(wcroot->abspath,
- svn_sqlite__column_text(stmt, 0, scratch_pool),
+ svn_sqlite__column_text(stmt, 0, NULL),
result_pool);
- apr_hash_set(*server_excluded_subtrees, abs_path, APR_HASH_KEY_STRING,
+ apr_hash_set(*excluded_subtrees, abs_path, APR_HASH_KEY_STRING,
abs_path);
SVN_ERR(svn_sqlite__step(&have_row, stmt));
}
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1341317&r1=1341316&r2=1341317&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Tue May 22 06:34:06 2012
@@ -3063,19 +3063,19 @@ svn_wc__db_has_switched_subtrees(svn_boo
const char *trail_url,
apr_pool_t *scratch_pool);
-/* Set @a *server_excluded_subtrees to a hash mapping <tt>const char *</tt>
+/* Set @a *excluded_subtrees to a hash mapping <tt>const char *</tt>
* local absolute paths to <tt>const char *</tt> local absolute paths for
- * every path at or under @a local_abspath in @a db which are excluded by
- * the server (e.g. due to authz). If no such paths are found then
+ * every path under @a local_abspath in @a db which are excluded by
+ * the server (e.g. due to authz), or user. If no such paths are found then
* @a *server_excluded_subtrees is set to @c NULL.
* Allocate the hash and all items therein from @a result_pool.
*/
svn_error_t *
-svn_wc__db_get_server_excluded_subtrees(apr_hash_t **server_excluded_subtrees,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
+svn_wc__db_get_excluded_subtrees(apr_hash_t **server_excluded_subtrees,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Indicate in *IS_MODIFIED whether the working copy has local modifications,
* using DB. Use SCRATCH_POOL for temporary allocations.
Modified: subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c?rev=1341317&r1=1341316&r2=1341317&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c Tue May 22 06:34:06 2012
@@ -86,6 +86,7 @@ static const int slow_statements[] =
STMT_HAS_SWITCHED_WCROOT,
STMT_HAS_SWITCHED_WCROOT_REPOS_ROOT,
STMT_SELECT_ALL_NODES,
+ STMT_SELECT_ALL_EXCLUDED_WCROOT,
/* Is there a record? */
STMT_LOOK_FOR_WORK,
@@ -101,7 +102,6 @@ static const int slow_statements[] =
STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_FILES,
STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_IMMEDIATES,
STMT_INSERT_TARGET_WITH_CHANGELIST_DEPTH_INFINITY,
- STMT_SELECT_ALL_SERVER_EXCLUDED_NODES,
STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW,
STMT_SELECT_EXTERNALS_DEFINED,
STMT_SELECT_EXTERNAL_PROPERTIES,