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 2013/01/23 15:59:13 UTC

svn commit: r1437436 - in /subversion/trunk/subversion: libsvn_wc/wc_db_update_move.c tests/cmdline/update_tests.py

Author: philip
Date: Wed Jan 23 14:59:12 2013
New Revision: 1437436

URL: http://svn.apache.org/viewvc?rev=1437436&view=rev
Log:
Issue 4300, break infinite loop when bumping during move-update.

* subversion/libsvn_wc/wc_db_update_move.c
  (bump_moved_away): Add hash parameter, remove unused depth parameter,
   don't recurse on already bumped paths.
  (svn_wc__db_bump_moved_away): Create empty hash.

* subversion/tests/cmdline/update_tests.py
  (update_swapped_depth_dirs): Adjust expectations, remove XFAIL.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c
    subversion/trunk/subversion/tests/cmdline/update_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c?rev=1437436&r1=1437435&r2=1437436&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Wed Jan 23 14:59:12 2013
@@ -1555,11 +1555,16 @@ svn_wc__db_update_moved_away_conflict_vi
   return SVN_NO_ERROR;
 }
 
+/* Bump LOCAL_RELPATH, and all the children of LOCAL_RELPATH, that are
+   moved-to at op-depth greater than OP_DEPTH.  SRC_DONE is a hash
+   with keys that are 'const char *' relpaths that have already been
+   bumped.  Any bumped paths are added to SRC_DONE. */
 static svn_error_t *
 bump_moved_away(svn_wc__db_wcroot_t *wcroot,
                 const char *local_relpath,
-                svn_depth_t depth,
                 int op_depth,
+                apr_hash_t *src_done,
+                apr_pool_t *result_pool,
                 apr_pool_t *scratch_pool)
 {
   svn_sqlite__stmt_t *stmt;
@@ -1602,19 +1607,25 @@ bump_moved_away(svn_wc__db_wcroot_t *wcr
           while (relpath_depth(src_root_relpath) > src_op_depth)
             src_root_relpath = svn_relpath_dirname(src_root_relpath, iterpool);
 
-          err = svn_wc__db_read_conflict_internal(&conflict, wcroot,
-                                                  src_root_relpath,
-                                                  iterpool, iterpool);
-          /* ### TODO: check this is the right sort of tree-conflict? */
-          if (!err && !conflict)
+          if (!apr_hash_get(src_done, src_relpath, APR_HASH_KEY_STRING))
             {
-              /* ### TODO: verify moved_here? */
-              err = replace_moved_layer(src_relpath, dst_relpath, op_depth,
-                                        wcroot, iterpool);
-
-              if (!err)
-                err = bump_moved_away(wcroot, dst_relpath, depth,
-                                      relpath_depth(dst_relpath), iterpool);
+              apr_hash_set(src_done, apr_pstrdup(result_pool, src_relpath),
+                           APR_HASH_KEY_STRING, "");
+              err = svn_wc__db_read_conflict_internal(&conflict, wcroot,
+                                                      src_root_relpath,
+                                                      iterpool, iterpool);
+              /* ### TODO: check this is the right sort of tree-conflict? */
+              if (!err && !conflict)
+                {
+                  /* ### TODO: verify moved_here? */
+                  err = replace_moved_layer(src_relpath, dst_relpath, op_depth,
+                                            wcroot, iterpool);
+
+                  if (!err)
+                    err = bump_moved_away(wcroot, dst_relpath,
+                                          relpath_depth(dst_relpath), src_done,
+                                          result_pool, iterpool);
+                }
             }
         }
 
@@ -1636,11 +1647,15 @@ svn_wc__db_bump_moved_away(svn_wc__db_wc
                            svn_depth_t depth,
                            apr_pool_t *scratch_pool)
 {
+  apr_hash_t *src_done;
+
   /* ### TODO: raise tree-conflicts? */
   if (depth != svn_depth_infinity)
     return SVN_NO_ERROR;
 
-  SVN_ERR(bump_moved_away(wcroot, local_relpath, depth, 0, scratch_pool));
+  src_done = apr_hash_make(scratch_pool);
+  SVN_ERR(bump_moved_away(wcroot, local_relpath, 0, src_done,
+                          scratch_pool, scratch_pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/tests/cmdline/update_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/update_tests.py?rev=1437436&r1=1437435&r2=1437436&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/update_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/update_tests.py Wed Jan 23 14:59:12 2013
@@ -6358,7 +6358,6 @@ def incomplete_overcomplete(sbox):
                                         True,
                                         wc_dir, '-r', 3)
 
-@XFail()
 @Issue(4300)
 def update_swapped_depth_dirs(sbox):
   "text mod to file in swapped depth dir"
@@ -6397,10 +6396,9 @@ def update_swapped_depth_dirs(sbox):
 
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
-  # Hopefully this is the right output/disk/status for what
-  # we should get, but right now the update segfaults.
   expected_output = svntest.wc.State(wc_dir, {
     'A/B'         : Item(status='  ', treeconflict='C'),
+    'A/B/E'       : Item(status='  ', treeconflict='U'),
     'A/B/E/alpha' : Item(status='  ', treeconflict='U'),
   })
   expected_disk = svntest.main.greek_state.copy()
@@ -6415,7 +6413,9 @@ def update_swapped_depth_dirs(sbox):
     'A/E/B/F'      : Item(),
   })
   expected_status.tweak(wc_rev=2)
+  expected_status.tweak('A/B', treeconflict='C')
   expected_status.tweak('A/E', 'A/E/alpha', 'A/E/beta', 'A/E/B',
+                        'A/E/B/E', 'A/E/B/E/alpha', 'A/E/B/E/beta',
                         'A/E/B/lambda', 'A/E/B/F', wc_rev='-')
   svntest.actions.run_and_verify_update(wc_dir,
                                         expected_output,