Author: rhuijben
Date: Wed Dec 5 16:32:03 2012
New Revision: 1417513
URL: http://svn.apache.org/viewvc?rev=1417513&view=rev
Log:
Make retrieving the BASE properties on a node that doesn't have properties,
because it has some not-present state an error.
* subversion/libsvn_wc/wc-queries.sql
(STMT_SELECT_BASE_PROPS): Also select presence.
* subversion/libsvn_wc/wc_db.c
(svn_wc__db_base_get_props): In the no-properties case check the presence
and return an error instead of an empty hash for presence values that don't
have properties.
* subversion/tests/libsvn_wc/db-test.c
(validate_node): Don't retrieve properties for not present nodes.
Modified:
subversion/trunk/subversion/libsvn_wc/wc-queries.sql
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/tests/libsvn_wc/db-test.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=1417513&r1=1417512&r2=1417513&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Wed Dec 5 16:32:03
2012
@@ -305,7 +305,7 @@ WHERE wc_id = ?1 AND parent_relpath = ?2
AND presence != 'base-deleted'))
-- STMT_SELECT_BASE_PROPS
-SELECT properties FROM nodes
+SELECT properties, presence FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
-- STMT_SELECT_NODE_PROPS
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1417513&r1=1417512&r2=1417513&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Wed Dec 5 16:32:03 2012
@@ -2612,9 +2612,30 @@ svn_wc__db_base_get_props(apr_hash_t **p
scratch_pool);
if (err == NULL && *props == NULL)
{
- /* ### is this a DB constraint violation? the column "probably" should
- ### never be null. */
- *props = apr_hash_make(result_pool);
+ svn_wc__db_status_t presence;
+ presence = svn_sqlite__column_token(stmt, 1, presence_map);
+
+ if (presence == svn_wc__db_status_normal
+ || presence == svn_wc__db_status_incomplete)
+ {
+ /* ### is this a DB constraint violation? the column "probably"
should
+ ### never be null in this case.
+
+ ### Reproducable via:
+ ### touch f; svn wc add f; svn ci -mm
+ ### sqlite3 .svn/wc.db "select local_relpath, properties from
nodes"
+ */
+ *props = apr_hash_make(result_pool);
+ }
+ else
+ {
+ err = svn_sqlite__reset(stmt);
+ return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, err,
+ _("The node '%s' has a BASE status that"
+ " has no properties."),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+ }
}
return svn_error_compose_create(err, svn_sqlite__reset(stmt));
Modified: subversion/trunk/subversion/tests/libsvn_wc/db-test.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/db-test.c?rev=1417513&r1=1417512&r2=1417513&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/db-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/db-test.c Wed Dec 5 16:32:03
2012
@@ -576,8 +576,6 @@ validate_node(svn_wc__db_t *db,
SVN_TEST_ASSERT(kind == expected_kind);
SVN_TEST_ASSERT(status == expected_status);
- SVN_ERR(svn_wc__db_base_get_props(&props, db, path,
- scratch_pool, scratch_pool));
switch (status)
{
case svn_wc__db_status_server_excluded:
@@ -585,13 +583,18 @@ validate_node(svn_wc__db_t *db,
case svn_wc__db_status_incomplete:
case svn_wc__db_status_not_present:
/* Our tests aren't setting properties on these node types, so
- short-circuit examination of name/value pairs. */
+ short-circuit examination of name/value pairs, to avoid having
+ to handle the error from svn_wc__db_base_get_props(). */
return SVN_NO_ERROR;
-
default:
- SVN_TEST_ASSERT(props != NULL);
+ break; /* Fall through */
}
+ SVN_ERR(svn_wc__db_base_get_props(&props, db, path,
+ scratch_pool, scratch_pool));
+
+ SVN_TEST_ASSERT(props != NULL);
+
value = apr_hash_get(props, "p1", APR_HASH_KEY_STRING);
SVN_TEST_STRING_ASSERT(value->data, "v1");