Author: gstein
Date: Fri Mar 19 07:08:07 2010
New Revision: 925106
URL: http://svn.apache.org/viewvc?rev=925106&view=rev
Log:
Update some internal testing code which validates whether the DB-based
properties are aligned with the file-based properties. This aligns the
test with the current/proper semantics.
However, during a "revert" operation, there is an unstable intermediate
state where the WORKING_NODE table still contains a row (with incorrect
properties) which is then used to reinstall the working file. Thus,
enabling TEST_DB_PROPS will cause a failure.
Since this appears to advance correctness, and there are other parts of
our code definitely wrong... I'm committing it.
* subversion/libsvn_wc/props.c:
(svn_wc__load_props): the return value from read_pristine_props() will
always be non-NULL, so just immediately do a comparison against the
fetched base props. if there are no base props, then assert that the
pristine props are empty. do a similar compare for the working (aka
ACTUAL) props.
(svn_wc__load_revert_props): the base_get_props should always return
non-NULL, and these should always match the revert props.
Modified:
subversion/trunk/subversion/libsvn_wc/props.c
Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=925106&r1=925105&r2=925106&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Fri Mar 19 07:08:07 2010
@@ -293,29 +293,26 @@ svn_wc__load_props(apr_hash_t **base_pro
#ifdef TEST_DB_PROPS
{
apr_hash_t *db_base_props;
+
SVN_ERR(svn_wc__db_read_pristine_props(&db_base_props, db,
local_abspath,
scratch_pool, scratch_pool));
+ SVN_ERR_ASSERT(db_base_props != NULL);
if (base_props != NULL)
{
- if (apr_hash_count(base_props) > 0)
- {
- apr_array_header_t *diffs;
-
- SVN_ERR_ASSERT(db_base_props != NULL);
-
- SVN_ERR(svn_prop_diffs(&diffs, base_props, db_base_props,
- scratch_pool));
+ apr_array_header_t *diffs;
- SVN_ERR_ASSERT(diffs->nelts == 0);
- }
- else
- SVN_ERR_ASSERT(db_base_props == NULL ||
- (apr_hash_count(db_base_props) == 0));
+ SVN_ERR(svn_prop_diffs(&diffs, base_props, db_base_props,
+ scratch_pool));
+ SVN_ERR_ASSERT(diffs->nelts == 0);
}
else
- SVN_ERR_ASSERT(db_base_props == NULL);
+ {
+ /* If the propfile is missing, then we should see empty props
+ in the database. */
+ SVN_ERR_ASSERT(apr_hash_count(db_base_props) == 0);
+ }
}
#endif
}
@@ -336,28 +333,16 @@ svn_wc__load_props(apr_hash_t **base_pro
#ifdef TEST_DB_PROPS
{
apr_hash_t *db_props;
- SVN_ERR(svn_wc__db_read_props(&db_props, db, local_abspath,
- scratch_pool, scratch_pool));
-
- if (*props_p != NULL)
- {
- if (apr_hash_count(*props_p) > 0)
- {
- apr_array_header_t *diffs;
+ apr_array_header_t *diffs;
- SVN_ERR_ASSERT(db_props != NULL);
+ SVN_ERR_ASSERT(*props_p != NULL);
- SVN_ERR(svn_prop_diffs(&diffs, *props_p, db_props,
- scratch_pool));
+ SVN_ERR(svn_wc__db_read_props(&db_props, db, local_abspath,
+ scratch_pool, scratch_pool));
+ SVN_ERR_ASSERT(db_props != NULL);
- SVN_ERR_ASSERT(diffs->nelts == 0);
- }
- else
- SVN_ERR_ASSERT(db_props == NULL ||
- (apr_hash_count(db_props) == 0));
- }
- else
- SVN_ERR_ASSERT(db_props == NULL);
+ SVN_ERR(svn_prop_diffs(&diffs, *props_p, db_props, scratch_pool));
+ SVN_ERR_ASSERT(diffs->nelts == 0);
}
#endif
}
@@ -385,25 +370,18 @@ svn_wc__load_revert_props(apr_hash_t **r
*revert_props_p = apr_hash_make(result_pool);
}
- #ifdef TEST_DB_PROPS
+#ifdef TEST_DB_PROPS
{
apr_hash_t *db_props;
+ apr_array_header_t *diffs;
+
SVN_ERR(svn_wc__db_base_get_props(&db_props, db, local_abspath,
scratch_pool, scratch_pool));
+ SVN_ERR_ASSERT(db_props != NULL);
- if (apr_hash_count(*revert_props_p) > 0)
- {
- apr_array_header_t *diffs;
- SVN_ERR_ASSERT(db_props != NULL);
-
- SVN_ERR(svn_prop_diffs(&diffs, *revert_props_p, db_props,
- scratch_pool));
-
- SVN_ERR_ASSERT(diffs->nelts == 0);
- }
- else
- SVN_ERR_ASSERT(db_props == NULL ||
- (apr_hash_count(db_props) == 0));
+ SVN_ERR(svn_prop_diffs(&diffs, *revert_props_p, db_props,
+ scratch_pool));
+ SVN_ERR_ASSERT(diffs->nelts == 0);
}
#endif