After Philip's great work I see just three op-depth failures remaining:

> FAIL:  copy_tests.py 83: move a directory containing moved node
> FAIL:  lock_tests.py 40: uncommitted svn:needs-lock add/cp not read-only
> FAIL:  upgrade_tests.py 15: upgrade tree conflict data (f20->f21)

lock_tests.py 40 fails because my WC-to-WC copy code doesn't reset files
to read-write on disk when it copies them if svn:needs-lock was set on
the source, which the old code did; instead, it just copies exactly
what's there.

The attached patch is where I have got to today, attacking that from the
angle of abandoning my all-in-one approach now that Philip's made the
WC-to-WC code handle op-depth automatically.  I try to extend that to
cover this case.

As it says in the log msg, it fixes lock_tests.py 40 but breaks
copy_tests.py 47.  I haven't time today to go further with seeing why.

If anyone wants to look tonight, be my guest.

- Julian

Try to fix the op-depth code for copies.  This makes lock_tests.py 40 PASS
but copy_tests.py 47 FAIL, when compiled with SVN_WC__OP_DEPTH.

* subversion/libsvn_wc/copy.c
  (svn_wc_copy3): Always use the old one-node-at-a-time code.

* subversion/libsvn_wc/wc_db.c
  (db_op_copy, svn_wc__db_op_copy): Calculate the correct op depth
    internally, instead of using what the caller provides.
--This line, and those below, will be ignored--

Index: subversion/libsvn_wc/copy.c
===================================================================
--- subversion/libsvn_wc/copy.c	(revision 1037758)
+++ subversion/libsvn_wc/copy.c	(working copy)
@@ -723,7 +723,7 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
                                                         scratch_pool));
     }
 
-#ifdef SVN_WC__OP_DEPTH
+#ifdef __SVN_WC__OP_DEPTH
   if (svn_wc__db_same_db(db, src_abspath, dst_abspath, scratch_pool))
     {
       SVN_ERR(copy_versioned_tree(db, src_abspath, dst_abspath,
Index: subversion/libsvn_wc/wc_db.c
===================================================================
--- subversion/libsvn_wc/wc_db.c	(revision 1037758)
+++ subversion/libsvn_wc/wc_db.c	(working copy)
@@ -2975,6 +2975,15 @@ get_info_for_copy(apr_int64_t *copyfrom_
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+op_depth_for_copy(apr_int64_t *op_depth,
+                  apr_int64_t copyfrom_repos_id,
+                  const char *copyfrom_relpath,
+                  svn_revnum_t copyfrom_revision,
+                  svn_wc__db_pdh_t *pdh,
+                  const char *local_relpath,
+                  apr_pool_t *scratch_pool);
+
 /* Like svn_wc__db_op_copy(), but with PDH+LOCAL_RELPATH instead of
  * DB+LOCAL_ABSPATH. */
 static svn_error_t *
@@ -2982,7 +2991,6 @@ db_op_copy(svn_wc__db_pdh_t *src_pdh,
            const char *src_relpath,
            svn_wc__db_pdh_t *dst_pdh,
            const char *dst_relpath,
-           apr_int64_t dst_op_depth,
            const svn_skel_t *work_items,
            apr_pool_t *scratch_pool)
 {
@@ -2991,6 +2999,7 @@ db_op_copy(svn_wc__db_pdh_t *src_pdh,
   svn_wc__db_status_t status, dst_status;
   svn_boolean_t have_work;
   apr_int64_t copyfrom_id;
+  apr_int64_t dst_op_depth;
   svn_wc__db_kind_t kind;
   const apr_array_header_t *children;
 
@@ -2998,6 +3007,10 @@ db_op_copy(svn_wc__db_pdh_t *src_pdh,
                             &status, &kind, &have_work,
                             src_pdh, src_relpath, scratch_pool, scratch_pool));
 
+  SVN_ERR(op_depth_for_copy(&dst_op_depth, copyfrom_id,
+                            copyfrom_relpath, copyfrom_rev,
+                            dst_pdh, dst_relpath, scratch_pool));
+
   SVN_ERR_ASSERT(kind == svn_wc__db_kind_file || kind == svn_wc__db_kind_dir);
 
   /* ### New status, not finished, see notes/wc-ng/copying */
@@ -3112,10 +3125,6 @@ svn_wc__db_op_copy(svn_wc__db_t *db,
 {
   svn_wc__db_pdh_t *src_pdh, *dst_pdh;
   const char *src_relpath, *dst_relpath;
-#ifdef SVN_WC__OP_DEPTH
-  const char *dst_op_root_relpath;
-#endif
-  apr_int64_t dst_op_depth;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(src_abspath));
   SVN_ERR_ASSERT(svn_dirent_is_absolute(dst_abspath));
@@ -3132,19 +3141,9 @@ svn_wc__db_op_copy(svn_wc__db_t *db,
                                              scratch_pool, scratch_pool));
   VERIFY_USABLE_PDH(dst_pdh);
 
-#ifdef SVN_WC__OP_DEPTH
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&dst_pdh, &dst_op_root_relpath,
-                                             db, dst_op_root_abspath,
-                                             svn_sqlite__mode_readwrite,
-                                             scratch_pool, scratch_pool));
-  dst_op_depth = relpath_depth(dst_op_root_relpath);
-#else
-  dst_op_depth = 2;  /* ### temporary op_depth */
-#endif
-
   /* ### This should all happen in one transaction. */
   SVN_ERR(db_op_copy(src_pdh, src_relpath, dst_pdh, dst_relpath,
-                     dst_op_depth, work_items, scratch_pool));
+                     work_items, scratch_pool));
 
   return SVN_NO_ERROR;
 }

Reply via email to