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/03 18:37:35 UTC

svn commit: r906149 - in /subversion/trunk/subversion: libsvn_wc/entries.c libsvn_wc/workqueue.c tests/cmdline/copy_tests.py

Author: philip
Date: Wed Feb  3 17:37:33 2010
New Revision: 906149

URL: http://svn.apache.org/viewvc?rev=906149&view=rev
Log:
Fix the post-commit processing for deleted items. Delete itself is
still a bit dodgy: it can create spurious BASE nodes.

* subversion/libsvn_wc/entries.c
  (get_base_info_for_deleted): Handle copied parent that has moved
   from WORKING to BASE during post-commit.

* subversion/libsvn_wc/workqueue.c
  (run_deletion_postcommit): Only look for repository info in BASE
   when it is going to be used.

* subversion/tests/cmdline/copy_tests.py
  (test_list): Mark copy_delete_commit and reverse_merge_move PASS.

Modified:
    subversion/trunk/subversion/libsvn_wc/entries.c
    subversion/trunk/subversion/libsvn_wc/workqueue.c
    subversion/trunk/subversion/tests/cmdline/copy_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entries.c?rev=906149&r1=906148&r2=906149&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/entries.c (original)
+++ subversion/trunk/subversion/libsvn_wc/entries.c Wed Feb  3 17:37:33 2010
@@ -276,6 +276,7 @@
       const char *work_del_abspath;
       const char *parent_repos_relpath;
       const char *parent_abspath;
+      svn_wc__db_status_t parent_status;
 
       if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
         return svn_error_return(err);
@@ -296,13 +297,25 @@
       SVN_ERR_ASSERT(work_del_abspath != NULL);
       parent_abspath = svn_dirent_dirname(work_del_abspath, scratch_pool);
 
-      SVN_ERR(svn_wc__db_scan_addition(NULL, NULL,
-                                       &parent_repos_relpath,
-                                       &entry->repos,
-                                       &entry->uuid,
-                                       NULL, NULL, NULL, NULL,
-                                       db, parent_abspath,
-                                       result_pool, scratch_pool));
+      /* During post-commit the parent that was previously added may
+         have been moved from the WORKING tree to the BASE tree.  */
+      SVN_ERR(svn_wc__db_read_info(&parent_status, NULL, NULL,
+                                   &parent_repos_relpath,
+                                   &entry->repos, &entry->uuid,
+                                   NULL, NULL, NULL, NULL, NULL, NULL,
+                                   NULL, NULL, NULL, NULL, NULL, NULL,
+                                   NULL, NULL, NULL, NULL, NULL, NULL,
+                                   db, parent_abspath,
+                                   scratch_pool, scratch_pool));
+      if (parent_status == svn_wc__db_status_added
+          || parent_status == svn_wc__db_status_obstructed_add)
+        SVN_ERR(svn_wc__db_scan_addition(NULL, NULL,
+                                         &parent_repos_relpath,
+                                         &entry->repos,
+                                         &entry->uuid,
+                                         NULL, NULL, NULL, NULL,
+                                         db, parent_abspath,
+                                         result_pool, scratch_pool));
 
       /* Now glue it all together */
       *repos_relpath = svn_relpath_join(
@@ -416,20 +429,30 @@
           const char *parent_abspath;
           svn_wc__db_status_t parent_status;
 
-          /* We know the parent is in the WORKING tree (the topmost
-             node in a WORKING subtree cannot be deleted since you
-             would simply remove the whole subtree in that case).  */
+          /* The parent is in WORKING except during post-commit when
+             it may have been moved from the WORKING tree to the BASE
+             tree.  */
           parent_abspath = svn_dirent_dirname(work_del_abspath,
                                               scratch_pool);
-          SVN_ERR(svn_wc__db_scan_addition(&parent_status,
-                                           NULL,
-                                           NULL, NULL, NULL,
-                                           NULL, NULL, NULL, NULL,
-                                           db,
-                                           parent_abspath,
-                                           scratch_pool, scratch_pool));
+          SVN_ERR(svn_wc__db_read_info(&parent_status,
+                                       NULL, NULL, NULL, NULL, NULL,
+                                       NULL, NULL, NULL, NULL, NULL, NULL,
+                                       NULL, NULL, NULL, NULL, NULL, NULL,
+                                       NULL, NULL, NULL, NULL, NULL, NULL,
+                                       db, parent_abspath,
+                                       scratch_pool, scratch_pool));
+          if (parent_status == svn_wc__db_status_added
+              || parent_status == svn_wc__db_status_obstructed_add)
+            SVN_ERR(svn_wc__db_scan_addition(&parent_status,
+                                             NULL,
+                                             NULL, NULL, NULL,
+                                             NULL, NULL, NULL, NULL,
+                                             db,
+                                             parent_abspath,
+                                             scratch_pool, scratch_pool));
           if (parent_status == svn_wc__db_status_copied
-              || parent_status == svn_wc__db_status_moved_here)
+              || parent_status == svn_wc__db_status_moved_here
+              || parent_status == svn_wc__db_status_normal)
             {
               /* The parent is copied/moved here, so WORK_DEL_ABSPATH
                  is the root of a deleted subtree. Our COPIED status
@@ -444,7 +467,12 @@
                  Note: MOVED_HERE is a concept foreign to this old
                  interface, but it is best represented as if a copy
                  had occurred, so we'll model it that way to old
-                 clients.  */
+                 clients.
+
+                 Note: svn_wc__db_status_normal corresponds to the
+                 post-commit parent that was copied or moved in
+                 WORKING but has now been converted to BASE.
+              */
               if (SVN_IS_VALID_REVNUM(entry->cmt_rev))
                 {
                   /* The scan_deletion call will tell us if there

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=906149&r1=906148&r2=906149&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Wed Feb  3 17:37:33 2010
@@ -929,19 +929,8 @@
                                     scratch_pool));
         }
 
-      /* Remember the repository this node is associated with.  */
-      SVN_ERR(svn_wc__db_scan_base_repos(&repos_relpath, &repos_root_url,
-                                         &repos_uuid,
-                                         db, local_abspath,
-                                         scratch_pool, scratch_pool));
-
-      /* Else, we're deleting a file, and we can safely remove files
-         from revision control without screwing something else up.  */
-      SVN_ERR(svn_wc__internal_remove_from_revision_control(
-                db, local_abspath,
-                FALSE, FALSE, cancel_func, cancel_baton, scratch_pool));
-
-      /* If the parent entry's working rev 'lags' behind new_rev... */
+      /* Get hold of repository info, if we are going to need it,
+         before deleting the file, */
       SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, &parent_revision, NULL,
                                        NULL, NULL, NULL, NULL, NULL, NULL,
                                        NULL, NULL, NULL, NULL, NULL,
@@ -949,6 +938,18 @@
                                                               scratch_pool),
                                        scratch_pool, scratch_pool));
       if (new_revision > parent_revision)
+        SVN_ERR(svn_wc__db_scan_base_repos(&repos_relpath, &repos_root_url,
+                                           &repos_uuid, db, local_abspath,
+                                           scratch_pool, scratch_pool));
+
+      /* We're deleting a file, and we can safely remove files from
+         revision control without screwing something else up.  */
+      SVN_ERR(svn_wc__internal_remove_from_revision_control(
+                db, local_abspath,
+                FALSE, FALSE, cancel_func, cancel_baton, scratch_pool));
+
+      /* If the parent entry's working rev 'lags' behind new_rev... */
+      if (new_revision > parent_revision)
         {
           /* ...then the parent's revision is now officially a
              lie;  therefore, it must remember the file as being

Modified: subversion/trunk/subversion/tests/cmdline/copy_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/copy_tests.py?rev=906149&r1=906148&r2=906149&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/copy_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/copy_tests.py Wed Feb  3 17:37:33 2010
@@ -4335,7 +4335,7 @@
               no_wc_copy_overwrites,
               copy_modify_commit,
               copy_files_with_properties,
-              XFail(copy_delete_commit),
+              copy_delete_commit,
               mv_and_revert_directory,
               SkipUnless(copy_preserve_executable_bit, svntest.main.is_posix_os),
               wc_to_repos,
@@ -4409,7 +4409,7 @@
               commit_copy_depth_empty,
               copy_below_copy,
               XFail(move_below_move),
-              XFail(reverse_merge_move),
+              reverse_merge_move,
              ]
 
 if __name__ == '__main__':