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 2010/06/29 16:32:38 UTC
svn commit: r958993 - in /subversion/trunk/subversion: libsvn_wc/adm_ops.c
libsvn_wc/wc_db.c tests/cmdline/revert_tests.py
Author: rhuijben
Date: Tue Jun 29 14:32:38 2010
New Revision: 958993
URL: http://svn.apache.org/viewvc?rev=958993&view=rev
Log:
To improve database consistency, copy the not-present registration from the
parent into newly added directories in svn_wc_add4(). This allows retrieving
this data via svn_wc__db_read_info(). This fixes revert_tests.py 20.
* subversion/libsvn_wc/adm_ops.c
(svn_wc_delete4): Fix is-replaced check by allowing not-present base
data.
(svn_wc_add4): Copy not-present data from the stub to the directory
on adding a new wcroot.
* subversion/libsvn_wc/wc_db.c
(svn_wc__db_base_add_absent_node): Fix adding data in the parent stub,
by fixing the stub check and then adding a parent node if needed.
* subversion/tests/cmdline/revert_tests.py
(revert_add_over_not_present_dir): Update comment
(test_list): Remove XFail marking of revert_add_over_not_present_dir.
Modified:
subversion/trunk/subversion/libsvn_wc/adm_ops.c
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/tests/cmdline/revert_tests.py
Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=958993&r1=958992&r2=958993&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Tue Jun 29 14:32:38 2010
@@ -879,7 +879,18 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
if (!have_base)
was_add = strcmp(op_root_abspath, local_abspath) == 0;
else
- was_replace = TRUE;
+ {
+ svn_wc__db_status_t base_status;
+ SVN_ERR(svn_wc__db_base_get_info(&base_status, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ db, local_abspath, pool, pool));
+
+ if (base_status != svn_wc__db_status_not_present)
+ was_replace = TRUE;
+ else
+ was_add = TRUE;
+ }
}
/* ### Maybe we should disallow deleting switched nodes here? */
@@ -1327,6 +1338,31 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
#ifndef SINGLE_DB
else if (kind == svn_node_dir && !node_exists && !is_replace)
{
+ svn_wc__db_status_t absent_status;
+ svn_wc__db_kind_t absent_kind;
+ const char *absent_repos_relpath, *absent_repos_root_url;
+ const char *absent_repos_uuid;
+ svn_revnum_t absent_revision;
+
+ /* Read the not present status from the parent working copy,
+ to reinsert it after hooking up the child working copy */
+
+ err = svn_wc__db_base_get_info(&absent_status,
+ &absent_kind,
+ &absent_revision,
+ &absent_repos_relpath,
+ &absent_repos_root_url,
+ &absent_repos_uuid,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ db, local_abspath,
+ scratch_pool, scratch_pool);
+
+ if (err && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+ return svn_error_return(err);
+ else
+ svn_error_clear(err);
+
/* Make sure this new directory has an admistrative subdirectory
created inside of it.
@@ -1339,7 +1375,19 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
repos_uuid, 0,
depth, scratch_pool));
- SVN_ERR(svn_wc__db_base_remove(db, local_abspath, scratch_pool));
+ if (!err && absent_status == svn_wc__db_status_not_present)
+ SVN_ERR(svn_wc__db_base_add_absent_node(db, local_abspath,
+ absent_repos_relpath,
+ absent_repos_root_url,
+ absent_repos_uuid,
+ absent_revision,
+ absent_kind,
+ absent_status,
+ NULL,
+ NULL,
+ scratch_pool));
+ else
+ SVN_ERR(svn_wc__db_base_remove(db, local_abspath, scratch_pool));
}
#endif
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=958993&r1=958992&r2=958993&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Jun 29 14:32:38 2010
@@ -1626,10 +1626,24 @@ svn_wc__db_base_add_absent_node(svn_wc__
flush_entries(pdh);
- if (*local_abspath == '\0')
+ if (*local_relpath == '\0')
{
- SVN_ERR(navigate_to_parent(&pdh, db, pdh, svn_sqlite__mode_readwrite,
- scratch_pool));
+ svn_error_t *err;
+ err = navigate_to_parent(&pdh, db, pdh, svn_sqlite__mode_readwrite,
+ scratch_pool);
+
+ if (err && err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY)
+ {
+ /* Not registered in the parent; we have to add a stub */
+ svn_error_clear(err);
+
+ SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+ svn_dirent_dirname(local_abspath, scratch_pool),
+ svn_sqlite__mode_readwrite, scratch_pool,
+ scratch_pool));
+ }
+ else
+ SVN_ERR(err);
VERIFY_USABLE_PDH(pdh);
SVN_ERR(create_repos_id(&repos_id, repos_root_url, repos_uuid,
Modified: subversion/trunk/subversion/tests/cmdline/revert_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/revert_tests.py?rev=958993&r1=958992&r2=958993&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/revert_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/revert_tests.py Tue Jun 29 14:32:38 2010
@@ -968,7 +968,7 @@ def revert_add_over_not_present_dir(sbox
main.run_svn(None, 'mkdir', os.path.join(wc_dir, 'A/C'))
- # This fails in the current WC-NG state (r927318).
+ # This failed in some WC-NG intermediate format (r927318-r958992).
main.run_svn(None, 'revert', os.path.join(wc_dir, 'A/C'))
svntest.actions.run_and_verify_status(wc_dir, expected_status)
@@ -1000,7 +1000,7 @@ test_list = [ None,
status_of_missing_dir_after_revert_replaced_with_history_dir),
revert_replaced_with_history_file_2,
revert_tree_conflicts_in_updated_files,
- XFail(revert_add_over_not_present_dir),
+ revert_add_over_not_present_dir,
]
if __name__ == '__main__':