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/08/31 14:30:20 UTC
svn commit: r991171 - in /subversion/trunk/subversion: libsvn_wc/adm_ops.c
libsvn_wc/workqueue.c tests/cmdline/revert_tests.py
Author: rhuijben
Date: Tue Aug 31 12:30:19 2010
New Revision: 991171
URL: http://svn.apache.org/viewvc?rev=991171&view=rev
Log:
Fix another regression in the revert code: The WORKING_NODE record
shouldn't just be removed for any addition, but only if the node is not
an operation root. This fixes revert_tests.py 22: "revert a child of a
copied directory does nothing"
* subversion/libsvn_wc/adm_ops.c
(revert_entry): Determine if the node is an add_root, instead of if it
is just added. Read BASE information in one place. Allow different kinds
for BASE and WORKING nodes.
* subversion/libsvn_wc/workqueue.c
(run_revert): Only remove the WORKING_NODE if the node is the operation
root.
* subversion/tests/cmdline/revert_tests.py
(test_list): Remove XFail marking from revert_child_of_copy.
Modified:
subversion/trunk/subversion/libsvn_wc/adm_ops.c
subversion/trunk/subversion/libsvn_wc/workqueue.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=991171&r1=991170&r2=991171&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Tue Aug 31 12:30:19 2010
@@ -1458,10 +1458,12 @@ revert_entry(svn_depth_t *depth,
svn_boolean_t *did_revert,
apr_pool_t *pool)
{
- svn_wc__db_status_t status;
- svn_wc__db_kind_t kind;
+ svn_wc__db_status_t status, base_status;
+ svn_wc__db_kind_t kind, base_kind;
svn_boolean_t replaced;
svn_boolean_t have_base;
+ svn_revnum_t base_revision;
+ svn_boolean_t is_add_root;
/* Initialize this even though revert_admin_things() is guaranteed
to set it, because we don't know that revert_admin_things() will
@@ -1475,14 +1477,37 @@ revert_entry(svn_depth_t *depth,
NULL, NULL,
db, local_abspath, pool, pool));
- SVN_ERR(svn_wc__internal_is_replaced(&replaced, db, local_abspath, pool));
+ if (have_base)
+ SVN_ERR(svn_wc__db_base_get_info(&base_status, &base_kind, &base_revision,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ db, local_abspath, pool, pool));
+
+ replaced = (status == svn_wc__db_status_added
+ && have_base
+ && base_status != svn_wc__db_status_not_present);
+
+ if (status == svn_wc__db_status_added)
+ {
+ const char *op_root_abspath;
+ SVN_ERR(svn_wc__db_scan_addition(NULL, &op_root_abspath, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ db, local_abspath, pool, pool));
+
+ is_add_root = (strcmp(op_root_abspath, local_abspath) == 0);
+ }
+ else
+#ifdef SVN_WC__SINGLE_DB
+ is_add_root = FALSE;
+#else
+ /* HACK: svn_wc__db_scan_addition doesn't allow this status! */
+ is_add_root = (status == svn_wc__db_status_obstructed_add);
+#endif
/* Additions. */
- if ((status == svn_wc__db_status_added
- || status == svn_wc__db_status_obstructed_add)
- && !replaced)
+ if (!replaced
+ && is_add_root)
{
- svn_revnum_t base_revision;
const char *repos_relpath;
const char *repos_root_url;
const char *repos_uuid;
@@ -1494,31 +1519,19 @@ revert_entry(svn_depth_t *depth,
The code below will then figure out the repository information, so
that we can later insert a node for the same repository. */
- if (have_base)
+ if (have_base
+ && base_status == svn_wc__db_status_not_present)
{
- svn_wc__db_status_t base_status;
- SVN_ERR(svn_wc__db_base_get_info(&base_status, NULL,
- &base_revision, &repos_relpath,
- &repos_root_url, &repos_uuid,
- NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- db, local_abspath,
- pool, pool));
+ /* Remember the BASE revision. (already handled) */
+ /* Remember the repository this node is associated with. */
- if (base_status == svn_wc__db_status_not_present)
- {
- /* Remember the BASE revision. */
- /* Remember the repository this node is associated with. */
-
- was_not_present = TRUE;
+ was_not_present = TRUE;
- if (!repos_root_url)
- SVN_ERR(svn_wc__db_scan_base_repos(&repos_relpath,
- &repos_root_url,
- &repos_uuid,
- db, local_abspath,
- pool, pool));
- }
+ SVN_ERR(svn_wc__db_scan_base_repos(&repos_relpath,
+ &repos_root_url,
+ &repos_uuid,
+ db, local_abspath,
+ pool, pool));
}
/* ### much of this is probably bullshit. we should be able to just
@@ -1587,7 +1600,7 @@ revert_entry(svn_depth_t *depth,
db, local_abspath,
repos_relpath, repos_root_url, repos_uuid,
base_revision,
- kind,
+ base_kind,
svn_wc__db_status_not_present,
NULL, NULL,
pool));
@@ -1597,7 +1610,8 @@ revert_entry(svn_depth_t *depth,
/* Deletions and replacements. */
else if (status == svn_wc__db_status_normal
|| status == svn_wc__db_status_deleted
- || replaced)
+ || replaced
+ || (status == svn_wc__db_status_added && !is_add_root))
{
/* Revert the prop and text mods (if any). */
SVN_ERR(revert_admin_things(&reverted, db, local_abspath,
Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=991171&r1=991170&r2=991171&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Tue Aug 31 12:30:19 2010
@@ -183,6 +183,7 @@ run_revert(svn_wc__db_t *db,
const char *local_abspath;
svn_boolean_t replaced;
svn_wc__db_kind_t kind;
+ svn_wc__db_status_t status;
const char *parent_abspath;
svn_boolean_t conflicted;
@@ -196,7 +197,7 @@ run_revert(svn_wc__db_t *db,
(yet) allowed. If we read any conflict files, then we (obviously) have
not removed them from the metadata (yet). */
SVN_ERR(svn_wc__db_read_info(
- NULL, &kind, NULL, NULL, NULL, NULL,
+ &status, &kind, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
&conflicted, NULL,
@@ -348,8 +349,22 @@ run_revert(svn_wc__db_t *db,
/* ### A working copy root can't have a working node and trying
### to delete it fails because the root doesn't have a stub. */
if (!is_wc_root)
- SVN_ERR(svn_wc__db_temp_op_remove_working(db, local_abspath,
- scratch_pool));
+ {
+ const char *op_root_abspath = NULL;
+
+ /* If the node is not the operation root, we should not delete
+ the working node */
+ if (status == svn_wc__db_status_added)
+ SVN_ERR(svn_wc__db_scan_addition(NULL, &op_root_abspath, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ db, local_abspath,
+ scratch_pool, scratch_pool));
+
+ if (!op_root_abspath
+ || (strcmp(op_root_abspath, local_abspath) == 0))
+ SVN_ERR(svn_wc__db_temp_op_remove_working(db, local_abspath,
+ scratch_pool));
+ }
}
return SVN_NO_ERROR;
@@ -368,14 +383,6 @@ verify_pristine_present(svn_wc__db_t *db
{
const svn_checksum_t *base_checksum;
- SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL,
- &base_checksum, NULL, NULL, NULL,
- db, local_abspath,
- scratch_pool, scratch_pool));
- if (base_checksum != NULL)
- return SVN_NO_ERROR;
-
SVN_ERR(svn_wc__db_read_info(NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, &base_checksum,
NULL, NULL, NULL, NULL, NULL, NULL,
@@ -385,6 +392,14 @@ verify_pristine_present(svn_wc__db_t *db
if (base_checksum != NULL)
return SVN_NO_ERROR;
+ SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ &base_checksum, NULL, NULL, NULL,
+ db, local_abspath,
+ scratch_pool, scratch_pool));
+ if (base_checksum != NULL)
+ return SVN_NO_ERROR;
+
/* A real file must have either a regular or a revert text-base.
If it has neither, we could be looking at the situation described
in issue #2101, in which case all we can do is deliver the expected
Modified: subversion/trunk/subversion/tests/cmdline/revert_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/revert_tests.py?rev=991171&r1=991170&r2=991171&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/revert_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/revert_tests.py Tue Aug 31 12:30:19 2010
@@ -1060,7 +1060,7 @@ test_list = [ None,
revert_tree_conflicts_in_updated_files,
revert_add_over_not_present_dir,
revert_added_tree,
- XFail(revert_child_of_copy),
+ revert_child_of_copy,
]
if __name__ == '__main__':