You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2010/02/02 19:56:22 UTC

svn commit: r905744 - in /subversion/trunk/subversion: libsvn_wc/wc_db.c tests/libsvn_wc/db-test.c

Author: philip
Date: Tue Feb  2 18:56:18 2010
New Revision: 905744

URL: http://svn.apache.org/viewvc?rev=905744&view=rev
Log:
Remove an SVN_ERR_ASSERT that can be triggered.  Not all commits trigger
this, it appears to need a sibling (possibly a non-deleted directory) of
the deleted item and it depends on the order in which the committed items
get processed.  copy_tests.py 8 still fails but it gets a bit further.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_scan_deletion): Remove assert, return work_del_abspath.

* subversion/tests/libsvn_wc/db-test.c
  (test_scan_deletion): Add example.
  (test_children): Adjust number of children.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/tests/libsvn_wc/db-test.c

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=905744&r1=905743&r2=905744&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Feb  2 18:56:18 2010
@@ -4569,9 +4569,14 @@
           /* No row means no WORKING node at this path, which means we just
              fell off the top of the WORKING tree.
 
-             The child cannot be not-present, as that would imply the
-             root of the (added) WORKING subtree was deleted.  */
-          SVN_ERR_ASSERT(child_presence != svn_wc__db_status_not_present);
+             If the child was not-present this implies the root of the
+             (added) WORKING subtree was deleted.  This can occur
+             during post-commit processing when the added parent that
+             was in the WORKING tree has been moved to the BASE tree. */
+          if(work_del_abspath != NULL
+             && child_presence == svn_wc__db_status_not_present
+             && *work_del_abspath == NULL)
+            *work_del_abspath = apr_pstrdup(result_pool, child_abspath);
 
           /* If the child did not have a BASE node associated with it, then
              we're looking at a deletion that occurred within an added tree.

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=905744&r1=905743&r2=905744&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/db-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/db-test.c Tue Feb  2 18:56:18 2010
@@ -302,6 +302,17 @@
    "insert into actual_node values ("
    "  1, 'I', '', null, null, null, null, null, 'changelist', null, "
    "'" I_TC_DATA "');"
+   "  "
+   "insert into base_node values ("
+   "  1, 'M', null, null, '', 'normal', 'dir', "
+   "  1, null, null, "
+   "  1, " TIME_1s ", '" AUTHOR_1 "', null, null, null, '()', null, null, "
+   "  null); "
+   "insert into working_node values ("
+   "  1, 'M/M-a', 'M', 'not-present', 'file', "
+   "  null, null, "
+   "  null, null, null, null, null, "
+   "  null, null, null, 0, null, null, '()', 0); "
    ),
 
   WC_METADATA_SQL_13,
@@ -772,7 +783,7 @@
   SVN_ERR(svn_wc__db_base_get_children(&children,
                                        db, local_abspath,
                                        pool, pool));
-  SVN_TEST_ASSERT(children->nelts == 11);
+  SVN_TEST_ASSERT(children->nelts == 12);
   for (i = children->nelts; i--; )
     {
       const char *name = APR_ARRAY_IDX(children, i, const char *);
@@ -784,7 +795,7 @@
   SVN_ERR(svn_wc__db_read_children(&children,
                                    db, local_abspath,
                                    pool, pool));
-  SVN_TEST_ASSERT(children->nelts == 12);
+  SVN_TEST_ASSERT(children->nelts == 13);
   for (i = children->nelts; i--; )
     {
       const char *name = APR_ARRAY_IDX(children, i, const char *);
@@ -1223,6 +1234,20 @@
   SVN_TEST_ASSERT(validate_abspath(local_abspath, "L/L-a",
                                    work_del_abspath, pool));
 
+  /* Root of delete, parent converted to BASE during post-commit. */
+  SVN_ERR(svn_wc__db_scan_deletion(
+            &base_del_abspath,
+            &base_replaced,
+            &moved_to_abspath,
+            &work_del_abspath,
+            db, svn_dirent_join(local_abspath, "M/M-a", pool),
+            pool, pool));
+  SVN_TEST_ASSERT(base_del_abspath == NULL);
+  SVN_TEST_ASSERT(!base_replaced);
+  SVN_TEST_ASSERT(moved_to_abspath == NULL);
+  SVN_TEST_ASSERT(validate_abspath(local_abspath, "M/M-a",
+                                   work_del_abspath, pool));
+
   return SVN_NO_ERROR;
 }
 



Re: svn commit: r905744 - in /subversion/trunk/subversion: libsvn_wc/wc_db.c tests/libsvn_wc/db-test.c

Posted by Greg Stein <gs...@gmail.com>.
Oooh. Tricky. Good one.

On Tue, Feb 2, 2010 at 13:56,  <ph...@apache.org> wrote:
> Author: philip
> Date: Tue Feb  2 18:56:18 2010
> New Revision: 905744
>
> URL: http://svn.apache.org/viewvc?rev=905744&view=rev
> Log:
> Remove an SVN_ERR_ASSERT that can be triggered.  Not all commits trigger
> this, it appears to need a sibling (possibly a non-deleted directory) of
> the deleted item and it depends on the order in which the committed items
> get processed.  copy_tests.py 8 still fails but it gets a bit further.
>
> * subversion/libsvn_wc/wc_db.c
>  (svn_wc__db_scan_deletion): Remove assert, return work_del_abspath.
>
> * subversion/tests/libsvn_wc/db-test.c
>  (test_scan_deletion): Add example.
>  (test_children): Adjust number of children.
>
> Modified:
>    subversion/trunk/subversion/libsvn_wc/wc_db.c
>    subversion/trunk/subversion/tests/libsvn_wc/db-test.c
>
> Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=905744&r1=905743&r2=905744&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
> +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Feb  2 18:56:18 2010
> @@ -4569,9 +4569,14 @@
>           /* No row means no WORKING node at this path, which means we just
>              fell off the top of the WORKING tree.
>
> -             The child cannot be not-present, as that would imply the
> -             root of the (added) WORKING subtree was deleted.  */
> -          SVN_ERR_ASSERT(child_presence != svn_wc__db_status_not_present);
> +             If the child was not-present this implies the root of the
> +             (added) WORKING subtree was deleted.  This can occur
> +             during post-commit processing when the added parent that
> +             was in the WORKING tree has been moved to the BASE tree. */
> +          if(work_del_abspath != NULL
> +             && child_presence == svn_wc__db_status_not_present
> +             && *work_del_abspath == NULL)
> +            *work_del_abspath = apr_pstrdup(result_pool, child_abspath);
>
>           /* If the child did not have a BASE node associated with it, then
>              we're looking at a deletion that occurred within an added tree.
>
> 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=905744&r1=905743&r2=905744&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/tests/libsvn_wc/db-test.c (original)
> +++ subversion/trunk/subversion/tests/libsvn_wc/db-test.c Tue Feb  2 18:56:18 2010
> @@ -302,6 +302,17 @@
>    "insert into actual_node values ("
>    "  1, 'I', '', null, null, null, null, null, 'changelist', null, "
>    "'" I_TC_DATA "');"
> +   "  "
> +   "insert into base_node values ("
> +   "  1, 'M', null, null, '', 'normal', 'dir', "
> +   "  1, null, null, "
> +   "  1, " TIME_1s ", '" AUTHOR_1 "', null, null, null, '()', null, null, "
> +   "  null); "
> +   "insert into working_node values ("
> +   "  1, 'M/M-a', 'M', 'not-present', 'file', "
> +   "  null, null, "
> +   "  null, null, null, null, null, "
> +   "  null, null, null, 0, null, null, '()', 0); "
>    ),
>
>   WC_METADATA_SQL_13,
> @@ -772,7 +783,7 @@
>   SVN_ERR(svn_wc__db_base_get_children(&children,
>                                        db, local_abspath,
>                                        pool, pool));
> -  SVN_TEST_ASSERT(children->nelts == 11);
> +  SVN_TEST_ASSERT(children->nelts == 12);
>   for (i = children->nelts; i--; )
>     {
>       const char *name = APR_ARRAY_IDX(children, i, const char *);
> @@ -784,7 +795,7 @@
>   SVN_ERR(svn_wc__db_read_children(&children,
>                                    db, local_abspath,
>                                    pool, pool));
> -  SVN_TEST_ASSERT(children->nelts == 12);
> +  SVN_TEST_ASSERT(children->nelts == 13);
>   for (i = children->nelts; i--; )
>     {
>       const char *name = APR_ARRAY_IDX(children, i, const char *);
> @@ -1223,6 +1234,20 @@
>   SVN_TEST_ASSERT(validate_abspath(local_abspath, "L/L-a",
>                                    work_del_abspath, pool));
>
> +  /* Root of delete, parent converted to BASE during post-commit. */
> +  SVN_ERR(svn_wc__db_scan_deletion(
> +            &base_del_abspath,
> +            &base_replaced,
> +            &moved_to_abspath,
> +            &work_del_abspath,
> +            db, svn_dirent_join(local_abspath, "M/M-a", pool),
> +            pool, pool));
> +  SVN_TEST_ASSERT(base_del_abspath == NULL);
> +  SVN_TEST_ASSERT(!base_replaced);
> +  SVN_TEST_ASSERT(moved_to_abspath == NULL);
> +  SVN_TEST_ASSERT(validate_abspath(local_abspath, "M/M-a",
> +                                   work_del_abspath, pool));
> +
>   return SVN_NO_ERROR;
>  }
>
>
>
>