You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2015/02/09 17:46:21 UTC

svn commit: r1658462 [30/31] - in /subversion/branches/move-tracking-2: ./ build/ build/generator/ build/generator/templates/ notes/ subversion/ subversion/bindings/cxxhl/include/svncxxhl/ subversion/bindings/javahl/native/ subversion/bindings/javahl/n...

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c?rev=1658462&r1=1658461&r2=1658462&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c Mon Feb  9 16:46:16 2015
@@ -25,8 +25,11 @@
 #include <apr_pools.h>
 
 #include "../svn_test.h"
+#include "../../libsvn_fs/fs-loader.h"
 #include "../../libsvn_fs_fs/fs.h"
 #include "../../libsvn_fs_fs/fs_fs.h"
+#include "../../libsvn_fs_fs/low_level.h"
+#include "../../libsvn_fs_fs/util.h"
 
 #include "svn_hash.h"
 #include "svn_pools.h"
@@ -1243,6 +1246,132 @@ id_parser_test(const svn_test_opts_t *op
 
 #undef REPO_NAME
 
+/* ------------------------------------------------------------------------ */
+
+#define REPO_NAME "test-repo-plain_0_length"
+
+static svn_error_t *
+receive_index(const svn_fs_fs__p2l_entry_t *entry,
+              void *baton,
+              apr_pool_t *scratch_pool)
+{
+  apr_array_header_t *entries = baton;
+  APR_ARRAY_PUSH(entries, svn_fs_fs__p2l_entry_t *)
+    = apr_pmemdup(entries->pool, entry, sizeof(*entry));
+
+  return SVN_NO_ERROR;
+}
+
+static apr_size_t
+stringbuf_find(svn_stringbuf_t *rev_contents,
+               const char *substring)
+{
+  apr_size_t i;
+  apr_size_t len = strlen(substring);
+
+  for (i = 0; i < rev_contents->len - len + 1; ++i)
+      if (!memcmp(rev_contents->data + i, substring, len))
+        return i;
+
+  return APR_SIZE_MAX;
+}
+
+static svn_error_t *
+plain_0_length(const svn_test_opts_t *opts,
+               apr_pool_t *pool)
+{
+  svn_fs_t *fs;
+  fs_fs_data_t *ffd;
+  svn_fs_txn_t *txn;
+  svn_fs_root_t *root;
+  svn_revnum_t rev;
+  const char *rev_path;
+  svn_stringbuf_t *rev_contents;
+  apr_hash_t *fs_config;
+  svn_filesize_t file_length;
+  apr_size_t offset;
+
+  if (strcmp(opts->fs_type, "fsfs") != 0)
+    return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL, NULL);
+
+  /* Create a repo that does not deltify properties and does not share reps
+     on its own - makes it easier to do that later by hand. */
+  SVN_ERR(svn_test__create_fs(&fs, REPO_NAME, opts, pool));
+  ffd = fs->fsap_data;
+  ffd->deltify_properties = FALSE;
+  ffd->rep_sharing_allowed = FALSE;
+
+  /* Create one file node with matching contents and property reps. */
+  SVN_ERR(svn_fs_begin_txn(&txn, fs, 0, pool));
+  SVN_ERR(svn_fs_txn_root(&root, txn, pool));
+  SVN_ERR(svn_fs_make_file(root, "foo", pool));
+  SVN_ERR(svn_test__set_file_contents(root, "foo", "END\n", pool));
+  SVN_ERR(svn_fs_change_node_prop(root, "foo", "x", NULL, pool));
+  SVN_ERR(svn_fs_commit_txn(NULL, &rev, txn, pool));
+
+  /* Redirect text rep to props rep. */
+  rev_path = svn_fs_fs__path_rev_absolute(fs, rev, pool);
+  SVN_ERR(svn_stringbuf_from_file2(&rev_contents, rev_path, pool));
+
+  offset = stringbuf_find(rev_contents, "id: ");
+  if (offset != APR_SIZE_MAX)
+    {
+      node_revision_t *noderev;
+      svn_stringbuf_t *noderev_str;
+
+      /* Read the noderev. */
+      svn_stream_t *stream = svn_stream_from_stringbuf(rev_contents, pool);
+      SVN_ERR(svn_stream_skip(stream, offset));
+      SVN_ERR(svn_fs_fs__read_noderev(&noderev, stream, pool, pool));
+      SVN_ERR(svn_stream_close(stream));
+
+      /* Tweak the DATA_REP. */
+      noderev->data_rep->revision = noderev->prop_rep->revision;
+      noderev->data_rep->item_index = noderev->prop_rep->item_index;
+      noderev->data_rep->size = noderev->prop_rep->size;
+      noderev->data_rep->expanded_size = 0;
+
+      /* Serialize it back. */
+      noderev_str = svn_stringbuf_create_empty(pool);
+      stream = svn_stream_from_stringbuf(noderev_str, pool);
+      SVN_ERR(svn_fs_fs__write_noderev(stream, noderev, ffd->format,
+                                       svn_fs_fs__fs_supports_mergeinfo(fs),
+                                       pool));
+      SVN_ERR(svn_stream_close(stream));
+
+      /* Patch the revision contents */
+      memcpy(rev_contents->data + offset, noderev_str->data, noderev_str->len);
+    }
+
+  SVN_ERR(svn_io_write_atomic(rev_path, rev_contents->data,
+                              rev_contents->len, NULL, pool));
+
+  if (svn_fs_fs__use_log_addressing(fs))
+    {
+      /* Refresh index data (checksums). */
+      apr_array_header_t *entries = apr_array_make(pool, 4, sizeof(void *));
+      SVN_ERR(svn_fs_fs__dump_index(fs, rev, receive_index, entries,
+                                    NULL, NULL, pool));
+      SVN_ERR(svn_fs_fs__load_index(fs, rev, entries, pool));
+    }
+
+  /* Create an independent FS instances with separate caches etc. */
+  fs_config = apr_hash_make(pool);
+  svn_hash_sets(fs_config, SVN_FS_CONFIG_FSFS_CACHE_NS,
+                svn_uuid_generate(pool));
+  SVN_ERR(svn_fs_open2(&fs, REPO_NAME, fs_config, pool, pool));
+
+  /* Now, check that we get the correct file length. */
+  SVN_ERR(svn_fs_revision_root(&root, fs, rev, pool));
+  SVN_ERR(svn_fs_file_length(&file_length, root, "foo", pool));
+
+  SVN_TEST_ASSERT(file_length == 4);
+
+  return SVN_NO_ERROR;
+}
+
+#undef REPO_NAME
+
 
 /* The test table.  */
 
@@ -1285,6 +1414,8 @@ static struct svn_test_descriptor_t test
                        "change revprops with enabled and disabled caching"),
     SVN_TEST_OPTS_PASS(id_parser_test,
                        "id parser test"),
+    SVN_TEST_OPTS_PASS(plain_0_length,
+                       "file with 0 expanded-length, issue #4554"),
     SVN_TEST_NULL
   };
 

Propchange: subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Feb  9 16:46:16 2015
@@ -10,6 +10,7 @@
 /subversion/branches/diff-optimizations-bytes/subversion/tests/libsvn_fs_x:1037353-1067789
 /subversion/branches/dont-save-plaintext-passwords-by-default/subversion/tests/libsvn_fs_x:870728-871118
 /subversion/branches/double-delete/subversion/tests/libsvn_fs_x:870511-872970
+/subversion/branches/dump-load-cross-check/subversion/tests/libsvn_fs_x:1654853-1657295
 /subversion/branches/ev2-export/subversion/tests/libsvn_fs_x:1325914,1332738,1413107
 /subversion/branches/explore-wc/subversion/tests/libsvn_fs_x:875486,875493,875497,875507,875511,875514,875559,875580-875581,875584,875587,875611,875627,875647,875667-875668,875711-875712,875733-875734,875736,875744-875748,875751,875758,875782,875795-875796,875830,875836,875838,875842,875852,875855,875864,875870,875873,875880,875885-875888,875890,875897-875898,875905,875907-875909,875935,875943-875944,875946,875979,875982-875983,875985-875986,875990,875997
 /subversion/branches/file-externals/subversion/tests/libsvn_fs_x:871779-873302
@@ -62,6 +63,7 @@
 /subversion/branches/revprop-cache/subversion/tests/libsvn_fs_x:1298521-1326293
 /subversion/branches/revprop-packing/subversion/tests/libsvn_fs_x:1143907,1143971,1143997,1144017,1144499,1144568,1146145
 /subversion/branches/subtree-mergeinfo/subversion/tests/libsvn_fs_x:876734-878766
+/subversion/branches/svn-auth-x509/subversion/tests/libsvn_fs_x:1603509-1655900
 /subversion/branches/svn-mergeinfo-enhancements/subversion/tests/libsvn_fs_x:870119-870195,870197-870288
 /subversion/branches/svn-patch-improvements/subversion/tests/libsvn_fs_x:918519-934609
 /subversion/branches/svn_mutex/subversion/tests/libsvn_fs_x:1141683-1182099
@@ -80,4 +82,4 @@
 /subversion/branches/verify-at-commit/subversion/tests/libsvn_fs_x:1462039-1462408
 /subversion/branches/verify-keep-going/subversion/tests/libsvn_fs_x:1439280-1492639,1546002-1546110
 /subversion/branches/wc-collate-path/subversion/tests/libsvn_fs_x:1402685-1480384
-/subversion/trunk/subversion/tests/libsvn_fs_x:1414756-1509914,1606692-1641646
+/subversion/trunk/subversion/tests/libsvn_fs_x:1414756-1509914,1606692-1658451

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_ra/ra-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_ra/ra-test.c?rev=1658462&r1=1658461&r2=1658462&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_ra/ra-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_ra/ra-test.c Mon Feb  9 16:46:16 2015
@@ -49,29 +49,21 @@ static const char tunnel_repos_name[] =
 
 
 static svn_error_t *
-make_and_open_local_repos(svn_ra_session_t **session,
-                          const char *repos_name,
-                          const svn_test_opts_t *opts,
-                          apr_pool_t *pool)
+make_and_open_repos(svn_ra_session_t **session,
+                    const char *repos_name,
+                    const svn_test_opts_t *opts,
+                    apr_pool_t *pool)
 {
-  svn_repos_t *repos;
   const char *url;
   svn_ra_callbacks2_t *cbtable;
 
   SVN_ERR(svn_ra_create_callbacks(&cbtable, pool));
-  SVN_ERR(svn_cmdline_create_auth_baton(&cbtable->auth_baton,
-                                        TRUE  /* non_interactive */,
-                                        "jrandom", "rayjandom",
-                                        NULL,
-                                        TRUE  /* no_auth_cache */,
-                                        FALSE /* trust_server_cert */,
-                                        NULL, NULL, NULL, pool));
+  SVN_ERR(svn_test__init_auth_baton(&cbtable->auth_baton, pool));
 
-  SVN_ERR(svn_test__create_repos(&repos, repos_name, opts, pool));
+  SVN_ERR(svn_test__create_repos2(NULL, &url, NULL, repos_name, opts,
+                                  pool, pool));
   SVN_ERR(svn_ra_initialize(pool));
 
-  SVN_ERR(svn_uri_get_file_url_from_dirent(&url, repos_name, pool));
-
   SVN_ERR(svn_ra_open4(session, NULL, url, NULL, cbtable, NULL, NULL, pool));
 
   return SVN_NO_ERROR;
@@ -272,9 +264,9 @@ location_segments_test(const svn_test_op
   b.segments = segments;
   b.pool = pool;
 
-  SVN_ERR(make_and_open_local_repos(&session,
-                                    "test-repo-locsegs", opts,
-                                    pool));
+  SVN_ERR(make_and_open_repos(&session,
+                              "test-repo-locsegs", opts,
+                              pool));
 
   /* ### This currently tests only a small subset of what's possible. */
   SVN_ERR(commit_changes(session, pool));
@@ -439,8 +431,11 @@ expect_error(const char *path,
   svn_lock_t *lock;
   struct lock_result_t *result = svn_hash_gets(results, path);
 
-  SVN_TEST_ASSERT(result && !result->lock && result->err);
+  SVN_TEST_ASSERT(result && result->err);
+  SVN_TEST_ASSERT(!result->lock);
+  /* RA layers shouldn't report SVN_ERR_FS_NOT_FOUND */
   SVN_ERR(svn_ra_get_lock(session, &lock, path, scratch_pool));
+
   SVN_TEST_ASSERT(!lock);
   return SVN_NO_ERROR;
 }
@@ -488,8 +483,7 @@ lock_test(const svn_test_opts_t *opts,
   struct lock_baton_t baton;
   apr_hash_index_t *hi;
 
-  SVN_ERR(make_and_open_local_repos(&session, "test-repo-lock", opts,
-                                    pool));
+  SVN_ERR(make_and_open_repos(&session, "test-repo-lock", opts, pool));
   SVN_ERR(commit_tree(session, pool));
 
   baton.results = apr_hash_make(pool);
@@ -564,11 +558,31 @@ lock_test(const svn_test_opts_t *opts,
   return SVN_NO_ERROR;
 }
 
+/* Test svn_ra_get_dir2(). */
+static svn_error_t *
+get_dir_test(const svn_test_opts_t *opts,
+             apr_pool_t *pool)
+{
+  svn_ra_session_t *session;
+  apr_hash_t *dirents;
+
+  SVN_ERR(make_and_open_repos(&session, "test-get-dir", opts, pool));
+  SVN_ERR(commit_tree(session, pool));
+
+  /* This call used to block on ra-svn for 1.8.0...r1656713 */
+  SVN_TEST_ASSERT_ERROR(svn_ra_get_dir2(session, &dirents, NULL, NULL,
+                                        "non/existing/relpath", 1,
+                                        SVN_DIRENT_KIND, pool),
+                        SVN_ERR_FS_NOT_FOUND);
+
+  return SVN_NO_ERROR;
+}
+
 
 
 /* The test table.  */
 
-static int max_threads = 1;
+static int max_threads = 2;
 
 static struct svn_test_descriptor_t test_funcs[] =
   {
@@ -581,6 +595,8 @@ static struct svn_test_descriptor_t test
                        "test ra_svn tunnel creation callbacks"),
     SVN_TEST_OPTS_PASS(lock_test,
                        "lock multiple paths"),
+    SVN_TEST_OPTS_PASS(get_dir_test,
+                       "test ra_get_dir2"),
     SVN_TEST_NULL
   };
 

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_repos/repos-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_repos/repos-test.c?rev=1658462&r1=1658461&r2=1658462&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_repos/repos-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_repos/repos-test.c Mon Feb  9 16:46:16 2015
@@ -3562,6 +3562,56 @@ test_repos_fs_type(const svn_test_opts_t
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+deprecated_access_context_api(const svn_test_opts_t *opts,
+                              apr_pool_t *pool)
+{
+  svn_repos_t *repos;
+  svn_fs_access_t *access;
+  svn_fs_txn_t *txn;
+  svn_fs_root_t *root;
+  const char *conflict;
+  svn_revnum_t new_rev;
+  const char *hook;
+
+  /* Create test repository. */
+  SVN_ERR(svn_test__create_repos(&repos,
+                                 "test-repo-deprecated-access-context-api",
+                                 opts, pool));
+
+  /* Set an empty pre-commit hook. */
+#ifdef WIN32
+  hook = apr_pstrcat(pool, svn_repos_pre_commit_hook(repos, pool), ".bat",
+                     SVN_VA_NULL);
+  SVN_ERR(svn_io_file_create(hook,
+                             "exit 0" APR_EOL_STR,
+                             pool));
+#else
+  hook = svn_repos_pre_commit_hook(repos, pool);
+  SVN_ERR(svn_io_file_create(hook,
+                             "#!/bin/sh" APR_EOL_STR "exit 0" APR_EOL_STR,
+                             pool));
+  SVN_ERR(svn_io_set_file_executable(hook, TRUE, FALSE, pool));
+#endif
+
+  /* Set some access context using svn_fs_access_add_lock_token(). */
+  SVN_ERR(svn_fs_create_access(&access, "jrandom", pool));
+  SVN_ERR(svn_fs_access_add_lock_token(access, "opaquelocktoken:abc"));
+  SVN_ERR(svn_fs_set_access(svn_repos_fs(repos), access));
+
+  /* Commit a new revision. */
+  SVN_ERR(svn_repos_fs_begin_txn_for_commit2(&txn, repos, 0,
+                                             apr_hash_make(pool), pool));
+  SVN_ERR(svn_fs_txn_root(&root, txn, pool));
+  SVN_ERR(svn_fs_make_dir(root, "/whatever", pool));
+  SVN_ERR(svn_repos_fs_commit_txn(&conflict, repos, &new_rev, txn, pool));
+
+  SVN_TEST_STRING_ASSERT(conflict, NULL);
+  SVN_TEST_ASSERT(new_rev == 1);
+
+  return SVN_NO_ERROR;
+}
+
 /* The test table.  */
 
 static int max_threads = 4;
@@ -3615,6 +3665,8 @@ static struct svn_test_descriptor_t test
                        "test svn_repos__config_pool_*"),
     SVN_TEST_OPTS_PASS(test_repos_fs_type,
                        "test test_repos_fs_type"),
+    SVN_TEST_OPTS_PASS(deprecated_access_context_api,
+                       "test deprecated access context api"),
     SVN_TEST_NULL
   };
 

Propchange: subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Feb  9 16:46:16 2015
@@ -52,3 +52,4 @@ read_length_tmp
 bit-array-test
 io-test-*
 sqlite-test-*
+x509-test

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/auth-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/auth-test.c?rev=1658462&r1=1658461&r2=1658462&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/auth-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/auth-test.c Mon Feb  9 16:46:16 2015
@@ -220,8 +220,8 @@ cleanup_callback(svn_boolean_t *delete_c
 {
   svn_auth_baton_t *b = walk_baton;
 
-  SVN_TEST_ASSERT(strcmp(cred_kind, SVN_AUTH_CRED_SIMPLE) == 0);
-  SVN_TEST_ASSERT(strcmp(realmstring, "<http://my.host> My realm") == 0);
+  SVN_TEST_STRING_ASSERT(cred_kind, SVN_AUTH_CRED_SIMPLE);
+  SVN_TEST_STRING_ASSERT(realmstring, "<http://my.host> My realm");
 
   SVN_ERR(svn_auth_forget_credentials(b, cred_kind, realmstring, scratch_pool));
 
@@ -272,7 +272,7 @@ test_auth_clear(apr_pool_t *pool)
                                      pool));
 
   creds = credentials;
-  SVN_TEST_ASSERT(strcmp(creds->username, "jrandom") == 0);
+  SVN_TEST_STRING_ASSERT(creds->username, "jrandom");
   SVN_TEST_ASSERT(creds->may_save);
 
   /* And tell that they are ok and can be saved */
@@ -292,7 +292,7 @@ test_auth_clear(apr_pool_t *pool)
 
   SVN_TEST_ASSERT(credentials);
   creds = credentials;
-  SVN_TEST_ASSERT(strcmp(creds->username, "jrandom") == 0);
+  SVN_TEST_STRING_ASSERT(creds->username, "jrandom");
   SVN_TEST_ASSERT(creds->may_save);
 
   /* Use our walker function to delete credentials (and forget them

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/dirent_uri-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/dirent_uri-test.c?rev=1658462&r1=1658461&r2=1658462&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/dirent_uri-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/dirent_uri-test.c Mon Feb  9 16:46:16 2015
@@ -809,6 +809,9 @@ static const testcase_canonicalize_t uri
     { "http://hst/foo/../bar","http://hst/foo/../bar" },
     { "http://hst/",          "http://hst" },
     { "http:///",             "http://" },
+    { "http:///example.com/", "http:///example.com" },
+    { "http:////example.com/", "http:///example.com" },
+    { "http://///////example.com/", "http:///example.com" },
     { "https://",             "https://" },
     { "file:///",             "file://" },
     { "file://",              "file://" },

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/io-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/io-test.c?rev=1658462&r1=1658461&r2=1658462&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/io-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/io-test.c Mon Feb  9 16:46:16 2015
@@ -680,6 +680,63 @@ aligned_seek_test(apr_pool_t *pool)
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+ignore_enoent(apr_pool_t *pool)
+{
+  const char *tmp_dir, *path;
+  const svn_io_dirent2_t *dirent_p;
+  apr_file_t *file;
+
+  /* Create an empty directory. */
+  SVN_ERR(svn_dirent_get_absolute(&tmp_dir, "ignore_enoent", pool));
+  SVN_ERR(svn_io_remove_dir2(tmp_dir, TRUE, NULL, NULL, pool));
+  SVN_ERR(svn_io_make_dir_recursively(tmp_dir, pool));
+  svn_test_add_dir_cleanup(tmp_dir);
+
+  /* Path does not exist. */
+  path = svn_dirent_join(tmp_dir, "not-present", pool);
+  SVN_ERR(svn_io_remove_dir2(path, TRUE, NULL, NULL, pool));
+  SVN_ERR(svn_io_remove_file2(path, TRUE, pool));
+  SVN_ERR(svn_io_set_file_read_only(path, TRUE, pool));
+  SVN_ERR(svn_io_set_file_read_write(path, TRUE, pool));
+  SVN_ERR(svn_io_set_file_executable(path, TRUE, TRUE, pool));
+  SVN_ERR(svn_io_set_file_executable(path, FALSE, TRUE, pool));
+  SVN_ERR(svn_io_stat_dirent2(&dirent_p, path, TRUE, TRUE, pool, pool));
+  SVN_ERR(svn_io_stat_dirent2(&dirent_p, path, FALSE, TRUE, pool, pool));
+  
+  /* Neither path nor parent exists. */
+  path = svn_dirent_join(path, "not-present", pool);
+  SVN_ERR(svn_io_remove_dir2(path, TRUE, NULL, NULL, pool));
+  SVN_ERR(svn_io_remove_file2(path, TRUE, pool));
+  SVN_ERR(svn_io_set_file_read_only(path, TRUE, pool));
+  SVN_ERR(svn_io_set_file_read_write(path, TRUE, pool));
+  SVN_ERR(svn_io_set_file_executable(path, TRUE, TRUE, pool));
+  SVN_ERR(svn_io_set_file_executable(path, FALSE, TRUE, pool));
+  SVN_ERR(svn_io_stat_dirent2(&dirent_p, path, TRUE, TRUE, pool, pool));
+  SVN_ERR(svn_io_stat_dirent2(&dirent_p, path, FALSE, TRUE, pool, pool));
+
+  /* File does exist. */
+  path = svn_dirent_join(tmp_dir, "present", pool);
+  SVN_ERR(svn_io_file_open(&file, path,
+                           APR_WRITE | APR_CREATE | APR_TRUNCATE,
+                           APR_OS_DEFAULT,
+                           pool));
+  SVN_ERR(svn_io_file_close(file, pool));
+
+  /* Path does not exist as child of file. */
+  path = svn_dirent_join(path, "not-present", pool);
+  SVN_ERR(svn_io_remove_dir2(path, TRUE, NULL, NULL, pool));
+  SVN_ERR(svn_io_remove_file2(path, TRUE, pool));
+  SVN_ERR(svn_io_set_file_read_only(path, TRUE, pool));
+  SVN_ERR(svn_io_set_file_read_write(path, TRUE, pool));
+  SVN_ERR(svn_io_set_file_executable(path, TRUE, TRUE, pool));
+  SVN_ERR(svn_io_set_file_executable(path, FALSE, TRUE, pool));
+  SVN_ERR(svn_io_stat_dirent2(&dirent_p, path, TRUE, TRUE, pool, pool));
+  SVN_ERR(svn_io_stat_dirent2(&dirent_p, path, FALSE, TRUE, pool, pool));
+
+  return SVN_NO_ERROR;
+}
+
 
 /* The test table.  */
 
@@ -700,6 +757,8 @@ static struct svn_test_descriptor_t test
                    "svn_io_read_length_line() shouldn't loop"),
     SVN_TEST_PASS2(aligned_seek_test,
                    "test aligned seek"),
+    SVN_TEST_PASS2(ignore_enoent,
+                   "test ignore-enoent"),
     SVN_TEST_NULL
   };
 

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/mergeinfo-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/mergeinfo-test.c?rev=1658462&r1=1658461&r2=1658462&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/mergeinfo-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/mergeinfo-test.c Mon Feb  9 16:46:16 2015
@@ -104,7 +104,7 @@ verify_mergeinfo_parse(const char *input
 
       /* Were we expecting any more ranges? */
       if (j < MAX_NBR_RANGES - 1
-          && !expected_ranges[j].end == 0)
+          && expected_ranges[j].end != 0)
         return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
                                  "svn_mergeinfo_parse (%s) failed to "
                                  "produce the expected number of ranges",

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/utf-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/utf-test.c?rev=1658462&r1=1658461&r2=1658462&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/utf-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/utf-test.c Mon Feb  9 16:46:16 2015
@@ -737,6 +737,92 @@ test_utf_is_normalized(apr_pool_t *pool)
   return SVN_NO_ERROR;
 }
 
+
+static svn_error_t *
+test_utf_conversions(apr_pool_t *pool)
+{
+  static const struct cvt_test_t
+  {
+    svn_boolean_t sixteenbit;
+    svn_boolean_t bigendian;
+    const char *source;
+    const char *result;
+  } tests[] = {
+
+#define UTF_32_LE FALSE, FALSE
+#define UTF_32_BE FALSE, TRUE
+#define UTF_16_LE TRUE, FALSE
+#define UTF_16_BE TRUE, TRUE
+
+    /* Normal character conversion */
+    { UTF_32_LE, "t\0\0\0" "e\0\0\0" "s\0\0\0" "t\0\0\0" "\0\0\0\0", "test" },
+    { UTF_32_BE, "\0\0\0t" "\0\0\0e" "\0\0\0s" "\0\0\0t" "\0\0\0\0", "test" },
+    { UTF_16_LE, "t\0" "e\0" "s\0" "t\0" "\0\0", "test" },
+    { UTF_16_BE, "\0t" "\0e" "\0s" "\0t" "\0\0", "test" },
+
+    /* Valid surrogate pairs */
+    { UTF_16_LE, "\x00\xD8" "\x00\xDC" "\0\0", "\xf0\x90\x80\x80" }, /* U+010000 */
+    { UTF_16_LE, "\x34\xD8" "\x1E\xDD" "\0\0", "\xf0\x9d\x84\x9e" }, /* U+01D11E */
+    { UTF_16_LE, "\xFF\xDB" "\xFD\xDF" "\0\0", "\xf4\x8f\xbf\xbd" }, /* U+10FFFD */
+
+    { UTF_16_BE, "\xD8\x00" "\xDC\x00" "\0\0", "\xf0\x90\x80\x80" }, /* U+010000 */
+    { UTF_16_BE, "\xD8\x34" "\xDD\x1E" "\0\0", "\xf0\x9d\x84\x9e" }, /* U+01D11E */
+    { UTF_16_BE, "\xDB\xFF" "\xDF\xFD" "\0\0", "\xf4\x8f\xbf\xbd" }, /* U+10FFFD */
+
+    /* Swapped, single and trailing surrogate pairs */
+    { UTF_16_LE, "*\0" "\x00\xDC" "\x00\xD8" "*\0\0\0", "*\xed\xb0\x80" "\xed\xa0\x80*" },
+    { UTF_16_LE, "*\0" "\x1E\xDD" "*\0\0\0", "*\xed\xb4\x9e*" },
+    { UTF_16_LE, "*\0" "\xFF\xDB" "*\0\0\0", "*\xed\xaf\xbf*" },
+    { UTF_16_LE, "\x1E\xDD" "\0\0", "\xed\xb4\x9e" },
+    { UTF_16_LE, "\xFF\xDB" "\0\0", "\xed\xaf\xbf" },
+
+    { UTF_16_BE, "\0*" "\xDC\x00" "\xD8\x00" "\0*\0\0", "*\xed\xb0\x80" "\xed\xa0\x80*" },
+    { UTF_16_BE, "\0*" "\xDD\x1E" "\0*\0\0", "*\xed\xb4\x9e*" },
+    { UTF_16_BE, "\0*" "\xDB\xFF" "\0*\0\0", "*\xed\xaf\xbf*" },
+    { UTF_16_BE, "\xDD\x1E" "\0\0", "\xed\xb4\x9e" },
+    { UTF_16_BE, "\xDB\xFF" "\0\0", "\xed\xaf\xbf" },
+
+#undef UTF_32_LE
+#undef UTF_32_BE
+#undef UTF_16_LE
+#undef UTF_16_BE
+
+    { 0 }
+  };
+
+  const struct cvt_test_t *tc;
+  const svn_string_t *result;
+  int i;
+
+  for (i = 1, tc = tests; tc->source; ++tc, ++i)
+    {
+      if (tc->sixteenbit)
+        SVN_ERR(svn_utf__utf16_to_utf8(&result, (const void*)tc->source,
+                                       SVN_UTF__UNKNOWN_LENGTH,
+                                       tc->bigendian, pool, pool));
+      else
+        SVN_ERR(svn_utf__utf32_to_utf8(&result, (const void*)tc->source,
+                                       SVN_UTF__UNKNOWN_LENGTH,
+                                       tc->bigendian, pool, pool));
+      SVN_ERR_ASSERT(0 == strcmp(result->data, tc->result));
+    }
+
+  /* Test counted strings with NUL characters */
+  SVN_ERR(svn_utf__utf16_to_utf8(
+              &result, (void*)("x\0" "\0\0" "y\0" "*\0"), 3,
+              FALSE, pool, pool));
+  SVN_ERR_ASSERT(0 == memcmp(result->data, "x\0y", 3));
+
+  SVN_ERR(svn_utf__utf32_to_utf8(
+              &result,
+              (void*)("\0\0\0x" "\0\0\0\0" "\0\0\0y" "\0\0\0*"), 3,
+              TRUE, pool, pool));
+  SVN_ERR_ASSERT(0 == memcmp(result->data, "x\0y", 3));
+
+  return SVN_NO_ERROR;
+}
+
+
 
 /* The test table.  */
 
@@ -761,6 +847,8 @@ static struct svn_test_descriptor_t test
                    "test svn_utf__fuzzy_escape"),
     SVN_TEST_PASS2(test_utf_is_normalized,
                    "test svn_utf__is_normalized"),
+    SVN_TEST_PASS2(test_utf_conversions,
+                   "test svn_utf__utf{16,32}_to_utf8"),
     SVN_TEST_NULL
   };
 

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_wc/conflict-data-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_wc/conflict-data-test.c?rev=1658462&r1=1658461&r2=1658462&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_wc/conflict-data-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_wc/conflict-data-test.c Mon Feb  9 16:46:16 2015
@@ -293,7 +293,7 @@ test_read_write_tree_conflicts(const svn
   child2_abspath = svn_dirent_join(parent_abspath, "bar", pool);
   SVN_ERR(sbox_wc_mkdir(&sbox, "A"));
   SVN_ERR(sbox_wc_mkdir(&sbox, "A/bar"));
-  sbox_file_write(&sbox, "A/foo", "");
+  SVN_ERR(sbox_file_write(&sbox, "A/foo", ""));
 
   conflict1 = tree_conflict_create(child1_abspath, svn_node_file,
                                    svn_wc_operation_merge,
@@ -621,8 +621,8 @@ test_serialize_tree_conflict(const svn_t
 
     SVN_TEST_ASSERT(reason == svn_wc_conflict_reason_moved_away);
     SVN_TEST_ASSERT(action == svn_wc_conflict_action_delete);
-    SVN_TEST_ASSERT(!strcmp(moved_away_op_root_abspath,
-                            sbox_wc_path(&sbox, "A/B")));
+    SVN_TEST_STRING_ASSERT(moved_away_op_root_abspath,
+                           sbox_wc_path(&sbox, "A/B"));
   }
 
   return SVN_NO_ERROR;

Modified: subversion/branches/move-tracking-2/subversion/tests/libsvn_wc/op-depth-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/libsvn_wc/op-depth-test.c?rev=1658462&r1=1658461&r2=1658462&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/branches/move-tracking-2/subversion/tests/libsvn_wc/op-depth-test.c Mon Feb  9 16:46:16 2015
@@ -144,23 +144,27 @@ props_hash_to_text(apr_hash_t *props, ap
   return str->len ? str->data : NULL;
 }
 
-/* Return a human-readable string representing ROW. */
+/* Return a human-readable string representing ROW. With a tiny bit of editting
+   this can be used to create expected results */
 static const char *
 print_row(const nodes_row_t *row,
           apr_pool_t *result_pool)
 {
+  const char *relpath_str, *presence_str;
   const char *file_external_str, *moved_here_str, *moved_to_str, *props;
 
   if (row == NULL)
     return "(null)";
 
+  relpath_str = apr_psprintf(result_pool, "\"%s\",", row->local_relpath);
+  presence_str = apr_psprintf(result_pool, "\"%s\",", row->presence);
   if (row->moved_to)
-    moved_to_str = apr_psprintf(result_pool, ", moved-to %s", row->moved_to);
+    moved_to_str = apr_psprintf(result_pool, ", \"%s\"", row->moved_to);
   else
     moved_to_str = "";
 
   if (row->moved_here)
-    moved_here_str = ", moved-here";
+    moved_here_str = ", MOVED_HERE";
   else
     moved_here_str = "";
 
@@ -175,19 +179,17 @@ print_row(const nodes_row_t *row,
     props = "";
 
   if (row->repo_revnum == SVN_INVALID_REVNUM)
-    return apr_psprintf(result_pool, "%d, \"%s\", \"%s\"%s%s%s%s",
-                        row->op_depth, row->local_relpath, row->presence,
+    return apr_psprintf(result_pool, "%d, %-20s%-15s NO_COPY_FROM%s%s%s%s",
+                        row->op_depth, relpath_str, presence_str,
                         moved_here_str, moved_to_str,
                         file_external_str, props);
   else
-    return apr_psprintf(result_pool, "%d, \"%s\", \"%s\", %s ^/%s@%d%s%s%s%s",
-                        row->op_depth, row->local_relpath, row->presence,
-                        row->op_depth == 0 ? "base" : "copyfrom",
-                        row->repo_relpath, (int)row->repo_revnum,
+    return apr_psprintf(result_pool, "%d, %-20s%-15s %d, \"%s\"%s%s%s%s",
+                        row->op_depth, relpath_str, presence_str,
+                        (int)row->repo_revnum, row->repo_relpath,
                         moved_here_str, moved_to_str,
                         file_external_str, props);
 }
-
 /* A baton to pass through svn_hash_diff() to compare_nodes_rows(). */
 typedef struct comparison_baton_t {
     apr_hash_t *expected_hash;  /* Maps "OP_DEPTH PATH" to nodes_row_t. */
@@ -514,7 +516,7 @@ wc_wc_copies(svn_test__sandbox_t *b)
 
   /* Create the various kinds of source node which will be copied */
 
-  sbox_file_write(b, source_added_file, "New file");
+  SVN_ERR(sbox_file_write(b, source_added_file, "New file"));
   SVN_ERR(sbox_wc_add(b, source_added_file));
   SVN_ERR(sbox_wc_mkdir(b, source_added_dir));
   SVN_ERR(sbox_wc_mkdir(b, source_added_dir2));
@@ -718,7 +720,7 @@ repo_wc_copies(svn_test__sandbox_t *b)
       }
 
     /* Perform each copy. */
-    SVN_ERR(svn_client_create_context(&ctx, b->pool));
+    SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
     for (subtest = subtests; subtest->from_path; subtest++)
       {
         svn_opt_revision_t rev = { svn_opt_revision_number, { 1 } };
@@ -787,7 +789,7 @@ test_deletes(const svn_test_opts_t *opts
   SVN_ERR(svn_test__sandbox_create(&b, "deletes", opts, pool));
   SVN_ERR(sbox_add_and_commit_greek_tree(&b));
 
-  sbox_file_write(&b,     "A/B/E/new-file", "New file");
+  SVN_ERR(sbox_file_write(&b,     "A/B/E/new-file", "New file"));
   SVN_ERR(sbox_wc_add(&b, "A/B/E/new-file"));
   {
     nodes_row_t rows[] = {
@@ -849,7 +851,7 @@ test_adds(const svn_test_opts_t *opts, a
   SVN_ERR(sbox_add_and_commit_greek_tree(&b));
 
   /* add file */
-  sbox_file_write(&b, "new-file", "New file");
+  SVN_ERR(sbox_file_write(&b, "new-file", "New file"));
   SVN_ERR(sbox_wc_add(&b, "new-file"));
   {
     nodes_row_t rows[] = {
@@ -871,7 +873,7 @@ test_adds(const svn_test_opts_t *opts, a
 
   /* replace file */
   SVN_ERR(sbox_wc_delete(&b, "iota"));
-  sbox_file_write(&b, "iota", "New iota file");
+  SVN_ERR(sbox_file_write(&b, "iota", "New iota file"));
   SVN_ERR(sbox_wc_add(&b, "iota"));
   {
     nodes_row_t rows[] = {
@@ -911,7 +913,7 @@ test_adds_change_kind(const svn_test_opt
 
   /* replace dir with file */
   SVN_ERR(sbox_wc_delete(&b, "A/B/E"));
-  sbox_file_write(&b, "A/B/E", "New E file");
+  SVN_ERR(sbox_file_write(&b, "A/B/E", "New E file"));
   SVN_ERR(sbox_wc_add(&b, "A/B/E"));
   {
     nodes_row_t rows[] = {
@@ -3112,7 +3114,7 @@ test_shadowed_update(const svn_test_opts
   SVN_ERR(svn_test__sandbox_create(&b, "shadowed_update", opts, pool));
 
   /* Set up the base state as revision 1. */
-  sbox_file_write(&b, "iota", "This is iota");
+  SVN_ERR(sbox_file_write(&b, "iota", "This is iota"));
   SVN_ERR(sbox_wc_add(&b, "iota"));
   SVN_ERR(sbox_wc_commit(&b, ""));
 
@@ -3127,7 +3129,7 @@ test_shadowed_update(const svn_test_opts
   SVN_ERR(sbox_wc_commit(&b, ""));
 
   /* And change something in r3 */
-  sbox_file_write(&b, "iota", "This is a new iota");
+  SVN_ERR(sbox_file_write(&b, "iota", "This is a new iota"));
   SVN_ERR(sbox_wc_commit(&b, ""));
 
   /* And delete C & M */
@@ -3448,12 +3450,12 @@ commit_file_external(const svn_test_opts
   svn_test__sandbox_t b;
 
   SVN_ERR(svn_test__sandbox_create(&b, "commit_file_external", opts, pool));
-  sbox_file_write(&b, "f", "this is f\n");
+  SVN_ERR(sbox_file_write(&b, "f", "this is f\n"));
   SVN_ERR(sbox_wc_add(&b, "f"));
   SVN_ERR(sbox_wc_propset(&b, "svn:externals", "^/f g", ""));
   SVN_ERR(sbox_wc_commit(&b, ""));
   SVN_ERR(sbox_wc_update(&b, "", 1));
-  sbox_file_write(&b, "g", "this is f\nmodified via g\n");
+  SVN_ERR(sbox_file_write(&b, "g", "this is f\nmodified via g\n"));
   SVN_ERR(sbox_wc_commit(&b, ""));
   SVN_ERR(sbox_wc_update(&b, "", 2));
 
@@ -3476,7 +3478,7 @@ revert_file_externals(const svn_test_opt
   svn_test__sandbox_t b;
 
   SVN_ERR(svn_test__sandbox_create(&b, "revert_file_externals", opts, pool));
-  sbox_file_write(&b, "f", "this is f\n");
+  SVN_ERR(sbox_file_write(&b, "f", "this is f\n"));
   SVN_ERR(sbox_wc_add(&b, "f"));
   SVN_ERR(sbox_wc_propset(&b, "svn:externals", "^/f g", ""));
   SVN_ERR(sbox_wc_commit(&b, ""));
@@ -3540,7 +3542,7 @@ copy_file_externals(const svn_test_opts_
   svn_test__sandbox_t b;
 
   SVN_ERR(svn_test__sandbox_create(&b, "copy_file_externals", opts, pool));
-  sbox_file_write(&b, "f", "this is f\n");
+  SVN_ERR(sbox_file_write(&b, "f", "this is f\n"));
   SVN_ERR(sbox_wc_add(&b, "f"));
   SVN_ERR(sbox_wc_mkdir(&b, "A"));
   SVN_ERR(sbox_wc_propset(&b, "svn:externals", "^/f g", "A"));
@@ -4572,27 +4574,27 @@ move_update(const svn_test_opts_t *opts,
   /* r1: Create files 'f', 'h' */
   SVN_ERR(sbox_wc_mkdir(&b, "A"));
   SVN_ERR(sbox_wc_mkdir(&b, "A/B"));
-  sbox_file_write(&b, "A/B/f", "r1 content\n");
-  sbox_file_write(&b, "A/B/h", "r1 content\n");
+  SVN_ERR(sbox_file_write(&b, "A/B/f", "r1 content\n"));
+  SVN_ERR(sbox_file_write(&b, "A/B/h", "r1 content\n"));
   SVN_ERR(sbox_wc_add(&b, "A/B/f"));
   SVN_ERR(sbox_wc_add(&b, "A/B/h"));
   SVN_ERR(sbox_wc_commit(&b, ""));
 
   /* r2: Modify 'f' */
-  sbox_file_write(&b, "A/B/f", "r1 content\nr2 content\n");
+  SVN_ERR(sbox_file_write(&b, "A/B/f", "r1 content\nr2 content\n"));
   SVN_ERR(sbox_wc_commit(&b, ""));
 
   /* r3: Delete 'h', add 'g' */
-  sbox_file_write(&b, "A/B/g", "r3 content\n");
+  SVN_ERR(sbox_file_write(&b, "A/B/g", "r3 content\n"));
   SVN_ERR(sbox_wc_add(&b, "A/B/g"));
   SVN_ERR(sbox_wc_delete(&b, "A/B/h"));
   SVN_ERR(sbox_wc_commit(&b, ""));
 
   /* r4: Add a new subtree 'X' */
   SVN_ERR(sbox_wc_mkdir(&b, "X"));
-  sbox_file_write(&b, "X/f", "r4 content\n");
-  sbox_file_write(&b, "X/g", "r4 content\n");
-  sbox_file_write(&b, "X/h", "r4 content\n");
+  SVN_ERR(sbox_file_write(&b, "X/f", "r4 content\n"));
+  SVN_ERR(sbox_file_write(&b, "X/g", "r4 content\n"));
+  SVN_ERR(sbox_file_write(&b, "X/h", "r4 content\n"));
   SVN_ERR(sbox_wc_add(&b, "X/f"));
   SVN_ERR(sbox_wc_add(&b, "X/g"));
   SVN_ERR(sbox_wc_add(&b, "X/h"));
@@ -5173,8 +5175,10 @@ mixed_rev_move(const svn_test_opts_t *op
   SVN_ERR(sbox_wc_mkdir(&b, "A"));
   SVN_ERR(sbox_wc_commit(&b, ""));
   SVN_ERR(sbox_wc_mkdir(&b, "A/B"));
+  SVN_ERR(sbox_wc_mkdir(&b, "A/D"));
   SVN_ERR(sbox_wc_commit(&b, ""));
   SVN_ERR(sbox_wc_mkdir(&b, "A/B/C"));
+  SVN_ERR(sbox_wc_mkdir(&b, "A/D/E"));
   SVN_ERR(sbox_wc_commit(&b, ""));
 
   {
@@ -5183,6 +5187,8 @@ mixed_rev_move(const svn_test_opts_t *op
       {0, "A",     "normal", 1, "A"},
       {0, "A/B",   "normal", 2, "A/B"},
       {0, "A/B/C", "normal", 3, "A/B/C"},
+      {0, "A/D",   "normal", 2, "A/D"},
+      {0, "A/D/E", "normal", 3, "A/D/E"},
       {0}
     };
     SVN_ERR(check_db_rows(&b, "", nodes));
@@ -5202,20 +5208,30 @@ mixed_rev_move(const svn_test_opts_t *op
       {0, "A",     "normal",       1, "A"},
       {0, "A/B",   "normal",       2, "A/B"},
       {0, "A/B/C", "normal",       3, "A/B/C"},
+      {0, "A/D",   "normal",       2, "A/D"},
+      {0, "A/D/E", "normal",       3, "A/D/E"},
       {1, "A",     "base-deleted", NO_COPY_FROM, "X"},
       {1, "A/B",   "base-deleted", NO_COPY_FROM},
       {1, "A/B/C", "base-deleted", NO_COPY_FROM},
+      {1, "A/D",   "base-deleted", NO_COPY_FROM},
+      {1, "A/D/E", "base-deleted", NO_COPY_FROM},
       {1, "X",     "normal",       1, "A", MOVED_HERE},
       {1, "X/B",   "not-present",  2, "A/B"},
+      {1, "X/D",   "not-present",  2, "A/D"},
       {2, "X/B",   "normal",       2, "A/B"},
       {2, "X/B/C", "not-present",  3, "A/B/C"},
+      {2, "X/D",   "normal",       2, "A/D"},
+      {2, "X/D/E", "not-present",  3, "A/D/E"},
       {3, "X/B/C", "normal",       3, "A/B/C"},
+      {3, "X/D/E", "normal",       3, "A/D/E"},
+
       {0}
     };
     SVN_ERR(check_db_rows(&b, "", nodes));
   }
 
   /* ### These values PASS but I'm not sure they are correct. */
+  /* A/B/C doesn't exist as X/B/C at op depth 1, but is reported */
   SVN_ERR(svn_wc__db_follow_moved_to(&moved_tos, b.wc_ctx->db,
                                      sbox_wc_path(&b, "A/B/C"), pool, pool));
   SVN_ERR(check_moved_to(moved_tos, 0, 1, "X/B/C"));
@@ -5241,32 +5257,109 @@ mixed_rev_move(const svn_test_opts_t *op
       {0, "A",     "normal",       1, "A"},
       {0, "A/B",   "normal",       2, "A/B"},
       {0, "A/B/C", "normal",       3, "A/B/C"},
+      {0, "A/D",   "normal",       2, "A/D"},
+      {0, "A/D/E", "normal",       3, "A/D/E"},
       {1, "A",     "base-deleted", NO_COPY_FROM, "X"},
       {1, "A/B",   "base-deleted", NO_COPY_FROM},
       {1, "A/B/C", "base-deleted", NO_COPY_FROM},
+      {1, "A/D",   "base-deleted", NO_COPY_FROM},
+      {1, "A/D/E", "base-deleted", NO_COPY_FROM},
       {1, "X",     "normal",       1, "A", MOVED_HERE},
       {1, "X/B",   "not-present",  2, "A/B"},
+      {1, "X/D",   "not-present",  2, "A/D"},
+      {2, "X/D",   "normal",       2, "A/D"},
+      {2, "X/D/E", "not-present",  3, "A/D/E"},
       {2, "X/Y",   "normal",       2, "A/B"},
       {2, "X/Y/C", "not-present",  NO_COPY_FROM},
       {3, "X/Y/C", "normal",       3, "A/B/C"},
+      {3, "X/D/E", "normal",       3, "A/D/E"},
+
       {0}
     };
     SVN_ERR(check_db_rows(&b, "", nodes));
   }
 
+  /* A/B/C still doesn't exist as X/B/C at op depth 1 */
   SVN_ERR(svn_wc__db_follow_moved_to(&moved_tos, b.wc_ctx->db,
                                      sbox_wc_path(&b, "A/B/C"), pool, pool));
-  SVN_TEST_ASSERT(moved_tos->nelts == 0);
+  SVN_ERR(check_moved_to(moved_tos, 0, 1, "X/B/C"));
+  SVN_TEST_ASSERT(moved_tos->nelts == 1);
 
+  /* A/B doesn't exist exist as X/B and the move to Y can't be tracked in
+     the current scheme */
   SVN_ERR(svn_wc__db_follow_moved_to(&moved_tos, b.wc_ctx->db,
                                      sbox_wc_path(&b, "A/B"), pool, pool));
-  SVN_TEST_ASSERT(moved_tos->nelts == 0);
+  SVN_ERR(check_moved_to(moved_tos, 0, 1, "X/B"));
+  SVN_TEST_ASSERT(moved_tos->nelts == 1);
 
   SVN_ERR(svn_wc__db_follow_moved_to(&moved_tos, b.wc_ctx->db,
                                      sbox_wc_path(&b, "A"), pool, pool));
   SVN_ERR(check_moved_to(moved_tos, 0, 1, "X"));
   SVN_TEST_ASSERT(moved_tos->nelts == 1);
 
+
+  SVN_ERR(sbox_wc_mkdir(&b, "Z"));
+  SVN_ERR(sbox_wc_commit(&b, "Z")); /* r4 */
+
+  SVN_ERR(sbox_wc_update(&b, "", 4));
+
+  {
+    nodes_row_t nodes[] = {
+      {0, "",      "normal",       4, ""},
+      {0, "A",     "normal",       4, "A"},
+      {0, "A/B",   "normal",       4, "A/B"},
+      {0, "A/B/C", "normal",       4, "A/B/C"},
+      {0, "A/D",   "normal",       4, "A/D"},
+      {0, "A/D/E", "normal",       4, "A/D/E"},
+      {1, "A",     "base-deleted", NO_COPY_FROM, "X"},
+      {1, "A/B",   "base-deleted", NO_COPY_FROM},
+      {1, "A/B/C", "base-deleted", NO_COPY_FROM},
+      {1, "A/D",   "base-deleted", NO_COPY_FROM},
+      {1, "A/D/E", "base-deleted", NO_COPY_FROM},
+      /* X is expanded on update. The not-present nodes are now here */
+      {1, "X",     "normal",       4, "A", MOVED_HERE},
+      {1, "X/B",   "normal",       4, "A/B", MOVED_HERE},
+      {1, "X/B/C", "normal",       4, "A/B/C", MOVED_HERE},
+      {1, "X/D",   "normal",       4, "A/D", MOVED_HERE},
+      {1, "X/D/E", "normal",       4, "A/D/E", MOVED_HERE},
+      {2, "X/D",   "normal",       2, "A/D"},
+      {2, "X/D/E", "not-present",  3, "A/D/E"},
+      {2, "X/Y",   "normal",       2, "A/B"},
+      {2, "X/Y/C", "not-present",  NO_COPY_FROM},
+      {3, "X/D/E", "normal",       3, "A/D/E"},
+      {3, "X/Y/C", "normal",       3, "A/B/C"},
+
+      {0, "Z",     "normal",       4, "Z"},
+      {0}
+    };
+
+    SVN_ERR(check_db_rows(&b, "", nodes));
+  }
+
+  SVN_ERR(svn_wc__db_follow_moved_to(&moved_tos, b.wc_ctx->db,
+                                     sbox_wc_path(&b, "A/B/C"), pool, pool));
+  SVN_ERR(check_moved_to(moved_tos, 0, 1, "X/B/C"));
+  SVN_TEST_ASSERT(moved_tos->nelts == 1);
+
+  SVN_ERR(svn_wc__db_follow_moved_to(&moved_tos, b.wc_ctx->db,
+                                     sbox_wc_path(&b, "A/B"), pool, pool));
+  SVN_ERR(check_moved_to(moved_tos, 0, 1, "X/B"));
+  SVN_TEST_ASSERT(moved_tos->nelts == 1);
+
+  SVN_ERR(svn_wc__db_follow_moved_to(&moved_tos, b.wc_ctx->db,
+                                     sbox_wc_path(&b, "A"), pool, pool));
+  SVN_ERR(check_moved_to(moved_tos, 0, 1, "X"));
+  SVN_TEST_ASSERT(moved_tos->nelts == 1);
+
+  {
+    conflict_info_t conflicts[] = {
+      { "X/D", FALSE, FALSE, TRUE },
+      {0}
+    };
+
+    SVN_ERR(check_db_conflicts(&b, "", conflicts));
+  }
+
   return SVN_NO_ERROR;
 }
 
@@ -5282,8 +5375,8 @@ update_prop_mod_into_moved(const svn_tes
   /* r1: Create files 'f', 'h' */
   SVN_ERR(sbox_wc_mkdir(&b, "A"));
   SVN_ERR(sbox_wc_mkdir(&b, "A/B"));
-  sbox_file_write(&b, "A/B/f", "r1 content\n");
-  sbox_file_write(&b, "A/B/h", "r1 content\n");
+  SVN_ERR(sbox_file_write(&b, "A/B/f", "r1 content\n"));
+  SVN_ERR(sbox_file_write(&b, "A/B/h", "r1 content\n"));
   SVN_ERR(sbox_wc_add(&b, "A/B/f"));
   SVN_ERR(sbox_wc_add(&b, "A/B/h"));
   SVN_ERR(sbox_wc_propset(&b, "pd", "f1", "A/B/f"));
@@ -5294,14 +5387,14 @@ update_prop_mod_into_moved(const svn_tes
 
   /* r2: Modify 'f'. Delete prop 'pd', modify prop 'pm', add prop 'pa',
    * leave prop 'pn' unchanged. */
-  sbox_file_write(&b, "A/B/f", "r1 content\nr2 content\n");
+  SVN_ERR(sbox_file_write(&b, "A/B/f", "r1 content\nr2 content\n"));
   SVN_ERR(sbox_wc_propset(&b, "pd", NULL, "A/B/f"));
   SVN_ERR(sbox_wc_propset(&b, "pm", "f2", "A/B/f"));
   SVN_ERR(sbox_wc_propset(&b, "pa", "f2", "A/B/f"));
   SVN_ERR(sbox_wc_commit(&b, ""));
 
   /* r3: Delete 'h', add 'g' */
-  sbox_file_write(&b, "A/B/g", "r3 content\n");
+  SVN_ERR(sbox_file_write(&b, "A/B/g", "r3 content\n"));
   SVN_ERR(sbox_wc_add(&b, "A/B/g"));
   SVN_ERR(sbox_wc_propset(&b, "p", "g3", "A/B/g"));
   SVN_ERR(sbox_wc_delete(&b, "A/B/h"));
@@ -5413,12 +5506,12 @@ nested_move_update(const svn_test_opts_t
   SVN_ERR(sbox_wc_mkdir(&b, "A"));
   SVN_ERR(sbox_wc_mkdir(&b, "A/B"));
   SVN_ERR(sbox_wc_mkdir(&b, "A/B/C"));
-  sbox_file_write(&b, "A/B/C/f", "r1 content\n");
+  SVN_ERR(sbox_file_write(&b, "A/B/C/f", "r1 content\n"));
   SVN_ERR(sbox_wc_add(&b, "A/B/C/f"));
   SVN_ERR(sbox_wc_commit(&b, ""));
 
   /* r2: Modify 'f' */
-  sbox_file_write(&b, "A/B/C/f", "r1 content\nr2 content\n");
+  SVN_ERR(sbox_file_write(&b, "A/B/C/f", "r1 content\nr2 content\n"));
   SVN_ERR(sbox_wc_commit(&b, ""));
 
   /* r3: Create 'X' */
@@ -5455,6 +5548,30 @@ nested_move_update(const svn_test_opts_t
 
   SVN_ERR(sbox_wc_update(&b, "", 2));
 
+  {
+    nodes_row_t nodes[] = {
+      {0, "",          "normal",       2, ""},
+      {0, "A",         "normal",       2, "A"},
+      {0, "A/B",       "normal",       2, "A/B"},
+      {0, "A/B/C",     "normal",       2, "A/B/C"},
+      {0, "A/B/C/f",   "normal",       2, "A/B/C/f"},
+      {1, "A",         "base-deleted", NO_COPY_FROM, "A2"},
+      {1, "A/B",       "base-deleted", NO_COPY_FROM},
+      {1, "A/B/C",     "base-deleted", NO_COPY_FROM},
+      {1, "A/B/C/f",   "base-deleted", NO_COPY_FROM},
+      {1, "A2",        "normal",       1, "A", MOVED_HERE},
+      {1, "A2/B",      "normal",       1, "A/B", MOVED_HERE},
+      {1, "A2/B/C",    "normal",       1, "A/B/C", MOVED_HERE},
+      {1, "A2/B/C/f",  "normal",       1, "A/B/C/f", MOVED_HERE},
+      {3, "A2/B/C",    "base-deleted", NO_COPY_FROM, "A2/B/C2"},
+      {3, "A2/B/C/f",  "base-deleted", NO_COPY_FROM},
+      {3, "A2/B/C2",   "normal",       1, "A/B/C", MOVED_HERE},
+      {3, "A2/B/C2/f", "normal",       1, "A/B/C/f", MOVED_HERE},
+      {0}
+    };
+    SVN_ERR(check_db_rows(&b, "", nodes));
+  }
+
   /* Following the A->A2 move should raise a tree-conflict on A2/B/C,
      resolving that may require an explicit resolve. */
   SVN_ERR(sbox_wc_resolve(&b, "A", svn_depth_empty,
@@ -5528,7 +5645,7 @@ nested_move_commit(const svn_test_opts_t
   SVN_ERR(sbox_wc_mkdir(&b, "A"));
   SVN_ERR(sbox_wc_mkdir(&b, "A/B"));
   SVN_ERR(sbox_wc_mkdir(&b, "A/B/C"));
-  sbox_file_write(&b, "A/B/C/f", "r1 content\n");
+  SVN_ERR(sbox_file_write(&b, "A/B/C/f", "r1 content\n"));
   SVN_ERR(sbox_wc_add(&b, "A/B/C/f"));
   SVN_ERR(sbox_wc_commit(&b, ""));
   SVN_ERR(sbox_wc_update(&b, "", 1));
@@ -5793,7 +5910,7 @@ check_tree_conflict_repos_path(svn_test_
 
       SVN_TEST_ASSERT(version != NULL);
 
-      SVN_TEST_ASSERT(!strcmp(version->path_in_repos, repos_path1));
+      SVN_TEST_STRING_ASSERT(version->path_in_repos, repos_path1);
     }
 
   if (repos_path2)
@@ -5803,7 +5920,7 @@ check_tree_conflict_repos_path(svn_test_
 
       SVN_TEST_ASSERT(version != NULL);
 
-      SVN_TEST_ASSERT(!strcmp(version->path_in_repos, repos_path2));
+      SVN_TEST_STRING_ASSERT(version->path_in_repos, repos_path2);
     }
 
   return SVN_NO_ERROR;
@@ -5829,7 +5946,7 @@ move_update_conflicts(const svn_test_opt
   SVN_ERR(sbox_wc_update(&b, "", 1));
   SVN_ERR(sbox_wc_move(&b, "A", "A2"));
   SVN_ERR(sbox_wc_move(&b, "A2/B/C", "A2/B/C2"));
-  sbox_file_write(&b, "A2/B/F", "obstruction\n");
+  SVN_ERR(sbox_file_write(&b, "A2/B/F", "obstruction\n"));
 
   {
     nodes_row_t nodes[] = {
@@ -5907,7 +6024,7 @@ move_update_delete_mods(const svn_test_o
   SVN_ERR(sbox_wc_mkdir(&b, "A/B"));
   SVN_ERR(sbox_wc_mkdir(&b, "A/B/C"));
   SVN_ERR(sbox_wc_mkdir(&b, "A/B/D"));
-  sbox_file_write(&b, "A/B/C/f", "r1 content\n");
+  SVN_ERR(sbox_file_write(&b, "A/B/C/f", "r1 content\n"));
   SVN_ERR(sbox_wc_add(&b, "A/B/C/f"));
   SVN_ERR(sbox_wc_commit(&b, ""));
   SVN_ERR(sbox_wc_delete(&b, "A/B/C"));
@@ -5916,7 +6033,7 @@ move_update_delete_mods(const svn_test_o
   SVN_ERR(sbox_wc_update(&b, "", 1));
 
   SVN_ERR(sbox_wc_move(&b, "A/B", "B2"));
-  sbox_file_write(&b, "B2/C/f", "modified content\n");
+  SVN_ERR(sbox_file_write(&b, "B2/C/f", "modified content\n"));
   SVN_ERR(sbox_wc_delete(&b, "B2/D"));
   {
     nodes_row_t nodes[] = {
@@ -6771,7 +6888,7 @@ finite_move_update_bump(const svn_test_o
   SVN_ERR(sbox_wc_mkdir(&b, "A/B/C"));
   SVN_ERR(sbox_wc_mkdir(&b, "P"));
   SVN_ERR(sbox_wc_mkdir(&b, "P/Q"));
-  sbox_file_write(&b, "P/Q/f", "r1 content\n");
+  SVN_ERR(sbox_file_write(&b, "P/Q/f", "r1 content\n"));
   SVN_ERR(sbox_wc_add(&b, "P/Q/f"));
   SVN_ERR(sbox_wc_commit(&b, ""));
   SVN_ERR(sbox_wc_mkdir(&b, "X"));
@@ -6808,10 +6925,25 @@ finite_move_update_bump(const svn_test_o
   SVN_ERR(sbox_wc_move(&b, "P/Q", "Q2"));
   SVN_ERR(sbox_wc_update_depth(&b, "A/B", 2, svn_depth_files, FALSE));
   SVN_ERR(sbox_wc_update_depth(&b, "P/Q", 2, svn_depth_files, FALSE));
-  SVN_ERR(check_tree_conflict_repos_path(&b, "A/B", NULL, NULL));
+  {
+    conflict_info_t conflicts[] = {
+      {"A/B", FALSE, FALSE, TRUE},
+      {"P/Q", FALSE, FALSE, TRUE},
+      {0}
+    };
+    SVN_ERR(check_db_conflicts(&b, "", conflicts));
+  }
+
+  SVN_ERR(check_tree_conflict_repos_path(&b, "A/B", "A/B", "A/B"));
+  SVN_ERR(check_tree_conflict_repos_path(&b, "P/Q", "P/Q", "P/Q"));
   err = sbox_wc_resolve(&b, "A/B", svn_depth_empty,
                         svn_wc_conflict_choose_mine_conflict);
   SVN_TEST_ASSERT_ERROR(err, SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE);
+
+  /* sbox_wc_resolve() obtains a lock on the target path, so now it
+     will apply the change on the target */
+  SVN_ERR(sbox_wc_resolve(&b, "P/Q", svn_depth_empty,
+                          svn_wc_conflict_choose_mine_conflict));
   {
     nodes_row_t nodes[] = {
       {0, "",        "normal",       1, ""},
@@ -6840,10 +6972,21 @@ finite_move_update_bump(const svn_test_o
   SVN_ERR(sbox_wc_move(&b, "P", "P2"));
   SVN_ERR(sbox_wc_update_depth(&b, "A/B", 2, svn_depth_immediates, FALSE));
   SVN_ERR(sbox_wc_update_depth(&b, "P", 2, svn_depth_immediates, FALSE));
-  SVN_ERR(check_tree_conflict_repos_path(&b, "P", NULL, NULL));
+  {
+    conflict_info_t conflicts[] = {
+      {"A/B", FALSE, FALSE, TRUE},
+      {"P", FALSE, FALSE, TRUE},
+      {0}
+    };
+    SVN_ERR(check_db_conflicts(&b, "", conflicts));
+  }
+  SVN_ERR(check_tree_conflict_repos_path(&b, "P", "P", "P"));
+  SVN_ERR(check_tree_conflict_repos_path(&b, "A/B", "A/B", "A/B"));
   err = sbox_wc_resolve(&b, "P", svn_depth_empty,
                         svn_wc_conflict_choose_mine_conflict);
   SVN_TEST_ASSERT_ERROR(err, SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE);
+  SVN_ERR(sbox_wc_resolve(&b, "A/B", svn_depth_empty,
+                          svn_wc_conflict_choose_mine_conflict));
   {
     nodes_row_t nodes[] = {
       {0, "",        "normal",       1, ""},
@@ -6874,10 +7017,21 @@ finite_move_update_bump(const svn_test_o
   SVN_ERR(sbox_wc_move(&b, "P/Q", "Q2"));
   SVN_ERR(sbox_wc_update_depth(&b, "A/B/C", 2, svn_depth_empty, FALSE));
   SVN_ERR(sbox_wc_update_depth(&b, "P/Q", 2, svn_depth_empty, FALSE));
-  SVN_ERR(check_tree_conflict_repos_path(&b, "P/Q", NULL, NULL));
+  {
+    conflict_info_t conflicts[] = {
+      {"A/B/C", FALSE, FALSE, TRUE},
+      {"P/Q", FALSE, FALSE, TRUE},
+      {0}
+    };
+    SVN_ERR(check_db_conflicts(&b, "", conflicts));
+  }
+  SVN_ERR(check_tree_conflict_repos_path(&b, "A/B/C", "A/B/C", "A/B/C"));
+  SVN_ERR(check_tree_conflict_repos_path(&b, "P/Q", "P/Q", "P/Q"));
   err = sbox_wc_resolve(&b, "P/Q", svn_depth_empty,
                         svn_wc_conflict_choose_mine_conflict);
   SVN_TEST_ASSERT_ERROR(err, SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE);
+  SVN_ERR(sbox_wc_resolve(&b, "A/B/C", svn_depth_empty,
+                          svn_wc_conflict_choose_mine_conflict));
   {
     nodes_row_t nodes[] = {
       {0, "",        "normal",       1, ""},
@@ -7894,6 +8048,42 @@ move_depth_expand(const svn_test_opts_t
 
   SVN_ERR(sbox_wc_update_depth(&b, "", 1, svn_depth_infinity, TRUE));
 
+  /* And now verify that there are no not-present nodes left and a
+     consistent working copy */
+  {
+    nodes_row_t nodes[] = {
+      {0, "",        "normal",       1, "" },
+
+      {0, "A",       "normal",       1, "A" },
+      {0, "A/A",     "normal",       1, "A/A" },
+      {0, "A/A/A",   "normal",       1, "A/A/A" },
+      {0, "A/A/A/A", "normal",       1, "A/A/A/A" },
+      {0, "A/B",     "normal",       1, "A/B" },
+      {0, "A/B/A",   "normal",       1, "A/B/A" },
+      {0, "A/B/A/A", "normal",       1, "A/B/A/A" },
+
+      {1, "A",       "base-deleted", NO_COPY_FROM, "C" },
+      {1, "A/A",     "base-deleted", NO_COPY_FROM },
+      {1, "A/A/A",   "base-deleted", NO_COPY_FROM },
+      {1, "A/B",     "base-deleted", NO_COPY_FROM },
+      {1, "A/B/A",   "base-deleted", NO_COPY_FROM },
+      {1, "A/B/A/A", "base-deleted", NO_COPY_FROM },
+      {1, "A/A/A/A", "base-deleted", NO_COPY_FROM },
+
+      {1, "C",       "normal",       1, "A", MOVED_HERE },
+      {1, "C/A",     "normal",       1, "A/A", MOVED_HERE },
+      {1, "C/B",     "not-present",  0, "A/B", MOVED_HERE},
+
+      {2, "C/B",     "normal",       1, "A/A" },
+
+      {3, "C/A/A",   "normal",       NO_COPY_FROM },
+      {3, "C/B/A",   "normal",       NO_COPY_FROM },
+
+      {0}
+    };
+    SVN_ERR(check_db_rows(&b, "", nodes));
+  }
+
   /* This used to cause a segfault. Then it asserted in a different place */
   SVN_ERR(sbox_wc_resolve(&b, "A", svn_depth_empty,
                           svn_wc_conflict_choose_mine_conflict));
@@ -7925,10 +8115,6 @@ move_depth_expand(const svn_test_opts_t
       {1, "C/A",     "normal",       1, "A/A", MOVED_HERE },
       {1, "C/A/A",   "normal",       1, "A/A/A", MOVED_HERE },
       {1, "C/A/A/A", "normal",       1, "A/A/A/A", MOVED_HERE },
-
-      {3, "C/A/A",   "normal",       NO_COPY_FROM },
-      {3, "C/A/A/A", "base-deleted", NO_COPY_FROM },
-
       {1, "C/B",     "normal",       1, "A/B", MOVED_HERE },
       {1, "C/B/A",   "normal",       1, "A/B/A", MOVED_HERE },
       {1, "C/B/A/A", "normal",       1, "A/B/A/A", MOVED_HERE },
@@ -7937,6 +8123,8 @@ move_depth_expand(const svn_test_opts_t
       {2, "C/B/A",   "base-deleted", NO_COPY_FROM },
       {2, "C/B/A/A", "base-deleted", NO_COPY_FROM },
 
+      {3, "C/A/A",   "normal",       NO_COPY_FROM },
+      {3, "C/A/A/A", "base-deleted", NO_COPY_FROM },
       {3, "C/B/A",   "normal",       NO_COPY_FROM },
 
       {0}
@@ -8104,7 +8292,7 @@ move_delete_file_externals(const svn_tes
 
   SVN_ERR(sbox_wc_mkdir(&b, "A"));
   SVN_ERR(sbox_wc_mkdir(&b, "A/B"));
-  sbox_file_write(&b, "f", "New file");
+  SVN_ERR(sbox_file_write(&b, "f", "New file"));
   SVN_ERR(sbox_wc_add(&b, "f"));
   SVN_ERR(sbox_wc_propset(&b, "svn:externals", "^/f B/P/g", "A"));
   SVN_ERR(sbox_wc_propset(&b, "svn:externals", "^/f Q/g\n^/f g", "A/B"));
@@ -8980,6 +9168,21 @@ init_move4(svn_test__sandbox_t *sandbox,
       SVN_ERR(sbox_wc_mkdir(sandbox, "C/A/A/NEW"));
       SVN_ERR(sbox_wc_mkdir(sandbox, "D/A/A/NEW"));
     }
+  else if (strstr(test_name, "_replace_"))
+    {
+      SVN_ERR(sbox_wc_delete(sandbox, "A/A/A/A"));
+      SVN_ERR(sbox_wc_delete(sandbox, "B/A/A/A"));
+      SVN_ERR(sbox_wc_delete(sandbox, "C/A/A/A"));
+      SVN_ERR(sbox_wc_delete(sandbox, "D/A/A/A"));
+      SVN_ERR(sbox_file_write(sandbox, "A/A/A/A", "A"));
+      SVN_ERR(sbox_file_write(sandbox, "B/A/A/A", "A"));
+      SVN_ERR(sbox_file_write(sandbox, "C/A/A/A", "A"));
+      SVN_ERR(sbox_file_write(sandbox, "D/A/A/A", "A"));
+      SVN_ERR(sbox_wc_add(sandbox, "A/A/A/A"));
+      SVN_ERR(sbox_wc_add(sandbox, "B/A/A/A"));
+      SVN_ERR(sbox_wc_add(sandbox, "C/A/A/A"));
+      SVN_ERR(sbox_wc_add(sandbox, "D/A/A/A"));
+    }
   else if (strstr(test_name, "_delself_"))
     {
       SVN_ERR(sbox_wc_delete(sandbox, "A/A/A"));
@@ -8987,6 +9190,21 @@ init_move4(svn_test__sandbox_t *sandbox,
       SVN_ERR(sbox_wc_delete(sandbox, "C/A/A"));
       SVN_ERR(sbox_wc_delete(sandbox, "D/A/A"));
     }
+  else if (strstr(test_name, "_replaceself_"))
+    {
+      SVN_ERR(sbox_wc_delete(sandbox, "A/A/A"));
+      SVN_ERR(sbox_wc_delete(sandbox, "B/A/A"));
+      SVN_ERR(sbox_wc_delete(sandbox, "C/A/A"));
+      SVN_ERR(sbox_wc_delete(sandbox, "D/A/A"));
+      SVN_ERR(sbox_file_write(sandbox, "A/A/A", "A"));
+      SVN_ERR(sbox_file_write(sandbox, "B/A/A", "A"));
+      SVN_ERR(sbox_file_write(sandbox, "C/A/A", "A"));
+      SVN_ERR(sbox_file_write(sandbox, "D/A/A", "A"));
+      SVN_ERR(sbox_wc_add(sandbox, "A/A/A"));
+      SVN_ERR(sbox_wc_add(sandbox, "B/A/A"));
+      SVN_ERR(sbox_wc_add(sandbox, "C/A/A"));
+      SVN_ERR(sbox_wc_add(sandbox, "D/A/A"));
+    }
 
   SVN_ERR(sbox_wc_commit(sandbox, ""));
   SVN_ERR(sbox_wc_update(sandbox, "", 1));
@@ -9135,6 +9353,26 @@ del4_update_add_AAA(const svn_test_opts_
 }
 
 static svn_error_t *
+del4_update_replace_AAA(const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+  svn_test__sandbox_t b;
+
+  SVN_ERR(init_move4(&b, "del4_update_replace_AAA", opts, FALSE, pool));
+
+  /* Update and resolve via mine strategy */
+  SVN_ERR(sbox_wc_update(&b, "", 2));
+  SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_mine_conflict));
+  /* Go back to start position */
+  SVN_ERR(sbox_wc_update(&b, "", 1));
+  SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_mine_conflict));
+  /* Update and resolve via their strategy */
+  SVN_ERR(sbox_wc_update(&b, "", 2));
+  SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_merged));
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
 del4_update_delself_AAA(const svn_test_opts_t *opts, apr_pool_t *pool)
 {
   svn_test__sandbox_t b;
@@ -9144,6 +9382,19 @@ del4_update_delself_AAA(const svn_test_o
   /* Update and resolve via mine strategy */
   SVN_ERR(sbox_wc_update(&b, "", 2));
 
+  {
+    conflict_info_t conflicts[] = {
+      {"A", FALSE, FALSE, TRUE},
+      {"B", FALSE, FALSE, TRUE},
+      {"C/A", FALSE, FALSE, TRUE},
+      {"D/A/A", FALSE, FALSE, TRUE},
+      {0}
+    };
+
+    SVN_ERR(check_db_conflicts(&b, "", conflicts));
+  }
+
+
   /* Resolve a few conflicts manually */
   SVN_ERR(sbox_wc_resolve(&b, "A", svn_depth_empty,
                           svn_wc_conflict_choose_mine_conflict));
@@ -9152,7 +9403,54 @@ del4_update_delself_AAA(const svn_test_o
   SVN_ERR(sbox_wc_resolve(&b, "C/A", svn_depth_empty,
                           svn_wc_conflict_choose_mine_conflict));
 
-  /* ### These can currently only be resolved to merged ???? */
+  {
+    nodes_row_t nodes[] = {
+      {0, "",           "normal",       2, ""},
+      {0, "A",          "normal",       2, "A"},
+      {0, "A/A",        "normal",       2, "A/A"},
+      {0, "B",          "normal",       2, "B"},
+      {0, "B/A",        "normal",       2, "B/A"},
+      {0, "C",          "normal",       2, "C"},
+      {0, "C/A",        "normal",       2, "C/A"},
+      {0, "D",          "normal",       2, "D"},
+      {0, "D/A",        "normal",       2, "D/A"},
+      {1, "A",          "normal",       2, "B", MOVED_HERE},
+      {1, "A/A",        "normal",       2, "B/A", MOVED_HERE},
+      {1, "AAA_1",      "normal",       1, "A/A/A"},
+      {1, "AAA_1/A",    "normal",       1, "A/A/A/A"},
+      {1, "AAA_2",      "normal",       1, "B/A/A"},
+      {1, "AAA_2/A",    "normal",       1, "B/A/A/A"},
+      {1, "AAA_3",      "normal",       1, "C/A/A"},
+      {1, "AAA_3/A",    "normal",       1, "C/A/A/A"},
+      {1, "B",          "base-deleted", NO_COPY_FROM, "A"},
+      {1, "B/A",        "base-deleted", NO_COPY_FROM},
+      {2, "A/A",        "normal",       2, "C/A", MOVED_HERE},
+      {2, "C/A",        "base-deleted", NO_COPY_FROM, "A/A"},
+      {3, "A/A/A",      "normal",       1, "D/A/A"},
+      {3, "A/A/A/A",    "normal",       1, "D/A/A/A"},
+
+      { 0 },
+    };
+
+    SVN_ERR(check_db_rows(&b, "", nodes));
+  }
+  {
+    conflict_info_t conflicts[] = {
+      /* Not resolved yet */
+      {"D/A/A", FALSE, FALSE, TRUE},
+
+      /* New */
+      {"A/A", FALSE, FALSE, TRUE},
+      {"A/A/A", FALSE, FALSE, TRUE},
+
+      {0}
+    };
+
+    SVN_ERR(check_db_conflicts(&b, "", conflicts));
+  }
+
+  /* These can only be resolved to merged, as the merge is already broken
+     (because the move source is gone): incoming delete on moved_away */
   SVN_ERR(sbox_wc_resolve(&b, "D/A/A", svn_depth_empty,
                           svn_wc_conflict_choose_merged));
   SVN_ERR(sbox_wc_resolve(&b, "A/A/A", svn_depth_empty,
@@ -9170,6 +9468,27 @@ del4_update_delself_AAA(const svn_test_o
 }
 
 static svn_error_t *
+del4_update_replaceself_AAA(const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+  svn_test__sandbox_t b;
+
+  SVN_ERR(init_move4(&b, "del4_update_replaceself_AAA", opts, FALSE, pool));
+
+  /* Update and resolve via mine strategy */
+  SVN_ERR(sbox_wc_update(&b, "", 2));
+  SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_mine_conflict));
+  /* Go back to start position */
+  SVN_ERR(sbox_wc_update(&b, "", 1));
+  SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_mine_conflict));
+  /* Update and resolve via their strategy */
+  SVN_ERR(sbox_wc_update(&b, "", 2));
+  SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_merged));
+
+  return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
 move4_update_edit_AAA(const svn_test_opts_t *opts, apr_pool_t *pool)
 {
     svn_test__sandbox_t b;
@@ -9231,7 +9550,7 @@ move4_update_edit_AAA(const svn_test_opt
         { 0, "A/A/A",     "normal",       2, "A/A/A", NOT_MOVED, "key" },
         { 1, "A/A/A",     "normal",       1, "B/A/A" },
         { 2, "A/A/A",     "normal",       1, "C/A/A" },
-        { 3, "A/A/A",     "normal",       1, "D/A/A" },
+        { 3, "A/A/A",     "normal",       1, "D/A/A", FALSE, "AAA_3"},
 
         { 0, "A/A/A/A",   "normal",       2, "A/A/A/A", NOT_MOVED, "key" },
         { 1, "A/A/A/A",   "normal",       1, "B/A/A/A" },
@@ -9240,7 +9559,8 @@ move4_update_edit_AAA(const svn_test_opt
 
         { 0 },
       };
-        SVN_ERR(check_db_rows(&b, "A/A/A", nodes));
+
+      SVN_ERR(check_db_rows(&b, "A/A/A", nodes));
     }
 
     return SVN_NO_ERROR;
@@ -9287,6 +9607,26 @@ move4_update_add_AAA(const svn_test_opts
 }
 
 static svn_error_t *
+move4_update_replace_AAA(const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+    svn_test__sandbox_t b;
+
+    SVN_ERR(init_move4(&b, "move4_update_replace_AAA", opts, TRUE, pool));
+
+    /* Update and resolve via mine strategy */
+    SVN_ERR(sbox_wc_update(&b, "", 2));
+    SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_mine_conflict));
+    /* Go back to start position */
+    SVN_ERR(sbox_wc_update(&b, "", 1));
+    SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_mine_conflict));
+    /* Update and resolve via their strategy */
+    SVN_ERR(sbox_wc_update(&b, "", 2));
+    SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_merged));
+
+    return SVN_NO_ERROR;
+}
+
+static svn_error_t *
 move4_update_delself_AAA(const svn_test_opts_t *opts, apr_pool_t *pool)
 {
     svn_test__sandbox_t b;
@@ -9317,13 +9657,44 @@ move4_update_delself_AAA(const svn_test_
 
     {
       nodes_row_t nodes[] = {
-
+        {0, "",               "normal",       2, ""},
+        {0, "A",              "normal",       2, "A"},
+        {0, "A/A",            "normal",       2, "A/A"},
+        {0, "B",              "normal",       2, "B"},
+        {0, "B/A",            "normal",       2, "B/A"},
+        {0, "C",              "normal",       2, "C"},
+        {0, "C/A",            "normal",       2, "C/A"},
+        {0, "D",              "normal",       2, "D"},
+        {0, "D/A",            "normal",       2, "D/A"},
+        {1, "A",              "normal",       1, "B", FALSE, "A_moved", TRUE},
+        {1, "A/A",            "normal",       1, "B/A", MOVED_HERE},
+        {1, "A/A/A",          "normal",       1, "B/A/A", MOVED_HERE},
+        {1, "A/A/A/A",        "normal",       1, "B/A/A/A", MOVED_HERE},
+        {1, "AAA_1",          "normal",       1, "A/A/A"},
+        {1, "AAA_1/A",        "normal",       1, "A/A/A/A"},
+        {1, "AAA_2",          "normal",       1, "B/A/A", MOVED_HERE},
+        {1, "AAA_2/A",        "normal",       1, "B/A/A/A", MOVED_HERE},
+        {1, "AAA_3",          "normal",       1, "C/A/A", MOVED_HERE},
+        {1, "AAA_3/A",        "normal",       1, "C/A/A/A", MOVED_HERE},
         {1, "A_moved",        "normal",       2, "A", MOVED_HERE},
         {1, "A_moved/A",      "normal",       2, "A/A", MOVED_HERE},
+        {1, "B",              "base-deleted", NO_COPY_FROM, "A"},
+        {1, "B/A",            "base-deleted", NO_COPY_FROM},
+        {1, "BA_moved",       "normal",       1, "B/A", MOVED_HERE},
+        {1, "BA_moved/A",     "normal",       1, "B/A/A", MOVED_HERE},
+        {1, "BA_moved/A/A",   "normal",       1, "B/A/A/A", MOVED_HERE},
+        {2, "A/A",            "normal",       1, "C/A", FALSE, "BA_moved", TRUE},
+        {2, "A/A/A",          "normal",       1, "C/A/A", MOVED_HERE},
+        {2, "A/A/A/A",        "normal",       1, "C/A/A/A", MOVED_HERE},
+        {2, "BA_moved/A",     "base-deleted", NO_COPY_FROM, "AAA_2"},
+        {2, "BA_moved/A/A",   "base-deleted", NO_COPY_FROM},
+        {2, "C/A",            "base-deleted", NO_COPY_FROM, "A/A"},
+        {3, "A/A/A",          "normal",       1, "D/A/A", FALSE, "AAA_3"},
+        {3, "A/A/A/A",        "normal",       1, "D/A/A/A"},
 
         { 0 },
       };
-        SVN_ERR(check_db_rows(&b, "A_moved", nodes));
+        SVN_ERR(check_db_rows(&b, "", nodes));
     }
 
     SVN_ERR(sbox_wc_resolve(&b, "B", svn_depth_empty,
@@ -9339,58 +9710,55 @@ move4_update_delself_AAA(const svn_test_
                             svn_wc_conflict_choose_merged));
     SVN_ERR(sbox_wc_resolve(&b, "A_moved/A/A", svn_depth_empty,
                             svn_wc_conflict_choose_merged));
-    /*SVN_ERR(check_db_conflicts(&b, "", NULL));*/
     SVN_ERR(sbox_wc_resolve(&b, "A/A", svn_depth_empty,
                             svn_wc_conflict_choose_mine_conflict));
     SVN_ERR(sbox_wc_resolve(&b, "BA_moved/A", svn_depth_empty,
                             svn_wc_conflict_choose_merged));
-    SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_mine_conflict));
+    SVN_ERR(check_db_conflicts(&b, "", NULL));
     /* Go back to start position */
     SVN_ERR(sbox_wc_update(&b, "", 1));
     {
       nodes_row_t nodes[] = {
         {0, "",               "normal",       1, ""},
         {0, "A",              "normal",       1, "A"},
-        {1, "A",              "normal",       2, "B", FALSE, "A_moved", TRUE},
         {0, "A/A",            "normal",       1, "A/A"},
+        {0, "A/A/A",          "normal",       1, "A/A/A"},
+        {0, "A/A/A/A",        "normal",       1, "A/A/A/A"},
+        {0, "B",              "normal",       1, "B"},
+        {0, "B/A",            "normal",       1, "B/A"},
+        {0, "B/A/A",          "normal",       1, "B/A/A"},
+        {0, "B/A/A/A",        "normal",       1, "B/A/A/A"},
+        {0, "C",              "normal",       1, "C"},
+        {0, "C/A",            "normal",       1, "C/A"},
+        {0, "C/A/A",          "normal",       1, "C/A/A"},
+        {0, "C/A/A/A",        "normal",       1, "C/A/A/A"},
+        {0, "D",              "normal",       1, "D"},
+        {0, "D/A",            "normal",       1, "D/A"},
+        {0, "D/A/A",          "normal",       1, "D/A/A"},
+        {0, "D/A/A/A",        "normal",       1, "D/A/A/A"},
+        {1, "A",              "normal",       2, "B", FALSE, "A_moved", TRUE},
         {1, "A/A",            "normal",       2, "B/A", MOVED_HERE},
-        {2, "A/A",            "normal",       2, "C/A", FALSE, "BA_moved", TRUE},
         {1, "A/A/A",          "base-deleted", NO_COPY_FROM},
-        {0, "A/A/A",          "normal",       1, "A/A/A"},
-        {3, "A/A/A",          "normal",       1, "D/A/A"},
         {1, "A/A/A/A",        "base-deleted", NO_COPY_FROM},
-        {0, "A/A/A/A",        "normal",       1, "A/A/A/A"},
-        {3, "A/A/A/A",        "normal",       1, "D/A/A/A"},
+        {1, "A_moved",        "normal",       2, "A", MOVED_HERE},
+        {1, "A_moved/A",      "normal",       2, "A/A", MOVED_HERE},
         {1, "AAA_1",          "normal",       1, "A/A/A"},
         {1, "AAA_1/A",        "normal",       1, "A/A/A/A"},
         {1, "AAA_2",          "normal",       1, "B/A/A"},
         {1, "AAA_2/A",        "normal",       1, "B/A/A/A"},
         {1, "AAA_3",          "normal",       1, "C/A/A"},
         {1, "AAA_3/A",        "normal",       1, "C/A/A/A"},
-        {1, "A_moved",        "normal",       2, "A", MOVED_HERE},
-        {1, "A_moved/A",      "normal",       2, "A/A", MOVED_HERE},
         {1, "B",              "base-deleted", NO_COPY_FROM, "A"},
-        {0, "B",              "normal",       1, "B"},
         {1, "B/A",            "base-deleted", NO_COPY_FROM},
-        {0, "B/A",            "normal",       1, "B/A"},
         {1, "B/A/A",          "base-deleted", NO_COPY_FROM},
-        {0, "B/A/A",          "normal",       1, "B/A/A"},
         {1, "B/A/A/A",        "base-deleted", NO_COPY_FROM},
-        {0, "B/A/A/A",        "normal",       1, "B/A/A/A"},
-        {1, "BA_moved",       "normal",       1, "A/A", MOVED_HERE},
-        {1, "BA_moved/A",     "normal",       1, "A/A/A", MOVED_HERE},
-        {1, "BA_moved/A/A",   "normal",       1, "A/A/A/A", MOVED_HERE},
-        {0, "C",              "normal",       1, "C"},
+        {1, "BA_moved",       "normal",       2, "B/A", MOVED_HERE},
+        {2, "A/A",            "normal",       2, "C/A", FALSE, "BA_moved", TRUE},
         {2, "C/A",            "base-deleted", NO_COPY_FROM, "A/A"},
-        {0, "C/A",            "normal",       1, "C/A"},
         {2, "C/A/A",          "base-deleted", NO_COPY_FROM},
-        {0, "C/A/A",          "normal",       1, "C/A/A"},
         {2, "C/A/A/A",        "base-deleted", NO_COPY_FROM},
-        {0, "C/A/A/A",        "normal",       1, "C/A/A/A"},
-        {0, "D",              "normal",       1, "D"},
-        {0, "D/A",            "normal",       1, "D/A"},
-        {0, "D/A/A",          "normal",       1, "D/A/A"},
-        {0, "D/A/A/A",        "normal",       1, "D/A/A/A"},
+        {3, "A/A/A",          "normal",       1, "D/A/A"},
+        {3, "A/A/A/A",        "normal",       1, "D/A/A/A"},
 
         { 0 },
       };
@@ -9405,6 +9773,26 @@ move4_update_delself_AAA(const svn_test_
 }
 
 static svn_error_t *
+move4_update_replaceself_AAA(const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+    svn_test__sandbox_t b;
+
+    SVN_ERR(init_move4(&b, "move4_update_replaceself_AAA", opts, TRUE, pool));
+
+    /* Update and resolve via mine strategy */
+    SVN_ERR(sbox_wc_update(&b, "", 2));
+    SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_mine_conflict));
+    /* Go back to start position */
+    SVN_ERR(sbox_wc_update(&b, "", 1));
+    SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_mine_conflict));
+    /* Update and resolve via their strategy */
+    SVN_ERR(sbox_wc_update(&b, "", 2));
+    SVN_ERR(sbox_wc_resolve(&b, "", svn_depth_infinity, svn_wc_conflict_choose_merged));
+
+    return SVN_NO_ERROR;
+}
+
+static svn_error_t *
 simple_move_bump(const svn_test_opts_t *opts, apr_pool_t *pool)
 {
   svn_test__sandbox_t b;
@@ -9653,7 +10041,6 @@ static svn_error_t *
 repo_wc_copy(const svn_test_opts_t *opts, apr_pool_t *pool)
 {
   svn_test__sandbox_t b;
-  const char *repos_dir;
   const char *new_repos_dir;
   const char *new_repos_url;
 
@@ -9681,15 +10068,13 @@ repo_wc_copy(const svn_test_opts_t *opts
     SVN_ERR(check_db_rows(&b, "AA", nodes));
   }
 
-  SVN_ERR(svn_uri_get_dirent_from_file_url(&repos_dir, b.repos_url,
-                                           pool));
-  new_repos_dir = apr_pstrcat(pool, repos_dir, "-2", SVN_VA_NULL);
+  new_repos_dir = apr_pstrcat(pool, b.repos_dir, "-2", SVN_VA_NULL);
   new_repos_url = apr_pstrcat(pool, b.repos_url, "-2", SVN_VA_NULL);
 
   svn_test_add_dir_cleanup(new_repos_dir);
 
   SVN_ERR(svn_io_remove_dir2(new_repos_dir, TRUE, NULL, NULL, pool));
-  SVN_ERR(svn_io_copy_dir_recursively(repos_dir,
+  SVN_ERR(svn_io_copy_dir_recursively(b.repos_dir,
                                       svn_dirent_dirname(new_repos_dir, pool),
                                       svn_dirent_basename(new_repos_dir, pool),
                                       FALSE, NULL, NULL, pool));
@@ -9931,6 +10316,274 @@ nested_move_delete(const svn_test_opts_t
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+move_within_mixed_move(const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+  svn_test__sandbox_t b;
+
+  SVN_ERR(svn_test__sandbox_create(&b, "move_within_mixed_move", opts, pool));
+
+  SVN_ERR(sbox_add_and_commit_greek_tree(&b));
+
+  SVN_ERR(sbox_wc_delete(&b, "iota"));
+  SVN_ERR(sbox_wc_commit(&b, ""));
+
+  /* Make A mixed revision */
+  SVN_ERR(sbox_wc_update(&b, "A/B/E", 2));
+
+  /* Single rev moves.. ok */
+  SVN_ERR(sbox_wc_move(&b, "A/D", "A/D_mv"));
+  SVN_ERR(sbox_wc_move(&b, "A/C", "C_mv"));
+
+  {
+    nodes_row_t nodes[] = {
+      {0, "",                 "normal",       0, ""},
+      {0, "A",                "normal",       1, "A"},
+      {0, "A/B",              "normal",       1, "A/B"},
+      {0, "A/B/E",            "normal",       2, "A/B/E"},
+      {0, "A/B/E/alpha",      "normal",       2, "A/B/E/alpha"},
+      {0, "A/B/E/beta",       "normal",       2, "A/B/E/beta"},
+      {0, "A/B/F",            "normal",       1, "A/B/F"},
+      {0, "A/B/lambda",       "normal",       1, "A/B/lambda"},
+      {0, "A/C",              "normal",       1, "A/C"},
+      {0, "A/D",              "normal",       1, "A/D"},
+      {0, "A/D/G",            "normal",       1, "A/D/G"},
+      {0, "A/D/G/pi",         "normal",       1, "A/D/G/pi"},
+      {0, "A/D/G/rho",        "normal",       1, "A/D/G/rho"},
+      {0, "A/D/G/tau",        "normal",       1, "A/D/G/tau"},
+      {0, "A/D/gamma",        "normal",       1, "A/D/gamma"},
+      {0, "A/D/H",            "normal",       1, "A/D/H"},
+      {0, "A/D/H/chi",        "normal",       1, "A/D/H/chi"},
+      {0, "A/D/H/omega",      "normal",       1, "A/D/H/omega"},
+      {0, "A/D/H/psi",        "normal",       1, "A/D/H/psi"},
+      {0, "A/mu",             "normal",       1, "A/mu"},
+      {0, "iota",             "not-present",  2, "iota"},
+      {1, "C_mv",             "normal",       1, "A/C", MOVED_HERE},
+      {2, "A/C",              "base-deleted", NO_COPY_FROM, "C_mv"},
+      {2, "A/D",              "base-deleted", NO_COPY_FROM, "A/D_mv"},
+      {2, "A/D/G",            "base-deleted", NO_COPY_FROM},
+      {2, "A/D/G/pi",         "base-deleted", NO_COPY_FROM},
+      {2, "A/D/G/rho",        "base-deleted", NO_COPY_FROM},
+      {2, "A/D/G/tau",        "base-deleted", NO_COPY_FROM},
+      {2, "A/D/gamma",        "base-deleted", NO_COPY_FROM},
+      {2, "A/D/H",            "base-deleted", NO_COPY_FROM},
+      {2, "A/D/H/chi",        "base-deleted", NO_COPY_FROM},
+      {2, "A/D/H/omega",      "base-deleted", NO_COPY_FROM},
+      {2, "A/D/H/psi",        "base-deleted", NO_COPY_FROM},
+      {2, "A/D_mv",           "normal",       1, "A/D", MOVED_HERE},
+      {2, "A/D_mv/G",         "normal",       1, "A/D/G", MOVED_HERE},
+      {2, "A/D_mv/G/pi",      "normal",       1, "A/D/G/pi", MOVED_HERE},
+      {2, "A/D_mv/G/rho",     "normal",       1, "A/D/G/rho", MOVED_HERE},
+      {2, "A/D_mv/G/tau",     "normal",       1, "A/D/G/tau", MOVED_HERE},
+      {2, "A/D_mv/gamma",     "normal",       1, "A/D/gamma", MOVED_HERE},
+      {2, "A/D_mv/H",         "normal",       1, "A/D/H", MOVED_HERE},
+      {2, "A/D_mv/H/chi",     "normal",       1, "A/D/H/chi", MOVED_HERE},
+      {2, "A/D_mv/H/omega",   "normal",       1, "A/D/H/omega", MOVED_HERE},
+      {2, "A/D_mv/H/psi",     "normal",       1, "A/D/H/psi", MOVED_HERE},
+      {0}
+    };
+
+    SVN_ERR(check_db_rows(&b, "", nodes));
+  }
+
+  /* Mixed rev move... breaks recordings "A/D" -> "A/D_mv"  */
+  SVN_ERR(sbox_wc_move(&b, "A", "A_mv"));
+
+  {
+    nodes_row_t nodes[] = {
+      {0, "",                 "normal",       0, ""},
+      {0, "A",                "normal",       1, "A"},
+      {0, "A/B",              "normal",       1, "A/B"},
+      {0, "A/B/E",            "normal",       2, "A/B/E"},
+      {0, "A/B/E/alpha",      "normal",       2, "A/B/E/alpha"},
+      {0, "A/B/E/beta",       "normal",       2, "A/B/E/beta"},
+      {0, "A/B/F",            "normal",       1, "A/B/F"},
+      {0, "A/B/lambda",       "normal",       1, "A/B/lambda"},
+      {0, "A/C",              "normal",       1, "A/C"},
+      {0, "A/D",              "normal",       1, "A/D"},
+      {0, "A/D/G",            "normal",       1, "A/D/G"},
+      {0, "A/D/G/pi",         "normal",       1, "A/D/G/pi"},
+      {0, "A/D/G/rho",        "normal",       1, "A/D/G/rho"},
+      {0, "A/D/G/tau",        "normal",       1, "A/D/G/tau"},
+      {0, "A/D/gamma",        "normal",       1, "A/D/gamma"},
+      {0, "A/D/H",            "normal",       1, "A/D/H"},
+      {0, "A/D/H/chi",        "normal",       1, "A/D/H/chi"},
+      {0, "A/D/H/omega",      "normal",       1, "A/D/H/omega"},
+      {0, "A/D/H/psi",        "normal",       1, "A/D/H/psi"},
+      {0, "A/mu",             "normal",       1, "A/mu"},
+      {0, "iota",             "not-present",  2, "iota"},
+      {1, "A",                "base-deleted", NO_COPY_FROM },
+      {1, "A/B",              "base-deleted", NO_COPY_FROM },
+      {1, "A/B/E",            "base-deleted", NO_COPY_FROM },
+      {1, "A/B/E/alpha",      "base-deleted", NO_COPY_FROM },
+      {1, "A/B/E/beta",       "base-deleted", NO_COPY_FROM },
+      {1, "A/B/F",            "base-deleted", NO_COPY_FROM },
+      {1, "A/B/lambda",       "base-deleted", NO_COPY_FROM },
+      {1, "A/C",              "base-deleted", NO_COPY_FROM, "C_mv"},
+      {1, "A/D",              "base-deleted", NO_COPY_FROM, "A/D_mv" },
+      {1, "A/D/G",            "base-deleted", NO_COPY_FROM },
+      {1, "A/D/G/pi",         "base-deleted", NO_COPY_FROM },
+      {1, "A/D/G/rho",        "base-deleted", NO_COPY_FROM },
+      {1, "A/D/G/tau",        "base-deleted", NO_COPY_FROM },
+      {1, "A/D/gamma",        "base-deleted", NO_COPY_FROM },
+      {1, "A/D/H",            "base-deleted", NO_COPY_FROM },
+      {1, "A/D/H/chi",        "base-deleted", NO_COPY_FROM },
+      {1, "A/D/H/omega",      "base-deleted", NO_COPY_FROM },
+      {1, "A/D/H/psi",        "base-deleted", NO_COPY_FROM },
+      {1, "A/mu",             "base-deleted", NO_COPY_FROM },
+      {1, "A_mv",             "normal",       1, "A"},
+      {1, "A_mv/B",           "normal",       1, "A/B"},
+      {1, "A_mv/B/E",         "not-present",  2, "A/B/E"},
+      {1, "A_mv/B/F",         "normal",       1, "A/B/F"},
+      {1, "A_mv/B/lambda",    "normal",       1, "A/B/lambda"},
+      {1, "A_mv/C",           "normal",       1, "A/C"},
+      {1, "A_mv/D",           "normal",       1, "A/D"},
+      {1, "A_mv/D/G",         "normal",       1, "A/D/G"},
+      {1, "A_mv/D/G/pi",      "normal",       1, "A/D/G/pi"},
+      {1, "A_mv/D/G/rho",     "normal",       1, "A/D/G/rho"},
+      {1, "A_mv/D/G/tau",     "normal",       1, "A/D/G/tau"},
+      {1, "A_mv/D/gamma",     "normal",       1, "A/D/gamma"},
+      {1, "A_mv/D/H",         "normal",       1, "A/D/H"},
+      {1, "A_mv/D/H/chi",     "normal",       1, "A/D/H/chi"},
+      {1, "A_mv/D/H/omega",   "normal",       1, "A/D/H/omega"},
+      {1, "A_mv/D/H/psi",     "normal",       1, "A/D/H/psi"},
+      {1, "A_mv/mu",          "normal",       1, "A/mu"},
+      {1, "C_mv",             "normal",       1, "A/C", MOVED_HERE},
+      {2, "A_mv/C",           "base-deleted", NO_COPY_FROM },
+      {2, "A_mv/D",           "base-deleted", NO_COPY_FROM },
+      {2, "A_mv/D/G",         "base-deleted", NO_COPY_FROM },
+      {2, "A_mv/D/G/pi",      "base-deleted", NO_COPY_FROM },
+      {2, "A_mv/D/G/rho",     "base-deleted", NO_COPY_FROM },
+      {2, "A_mv/D/G/tau",     "base-deleted", NO_COPY_FROM },
+      {2, "A_mv/D/gamma",     "base-deleted", NO_COPY_FROM },
+      {2, "A_mv/D/H",         "base-deleted", NO_COPY_FROM },
+      {2, "A_mv/D/H/chi",     "base-deleted", NO_COPY_FROM },
+      {2, "A_mv/D/H/omega",   "base-deleted", NO_COPY_FROM },
+      {2, "A_mv/D/H/psi",     "base-deleted", NO_COPY_FROM },
+      {2, "A_mv/D_mv",        "normal",       1, "A/D", MOVED_HERE},
+      {2, "A_mv/D_mv/G",      "normal",       1, "A/D/G", MOVED_HERE},
+      {2, "A_mv/D_mv/G/pi",   "normal",       1, "A/D/G/pi", MOVED_HERE},
+      {2, "A_mv/D_mv/G/rho",  "normal",       1, "A/D/G/rho", MOVED_HERE},
+      {2, "A_mv/D_mv/G/tau",  "normal",       1, "A/D/G/tau", MOVED_HERE},
+      {2, "A_mv/D_mv/gamma",  "normal",       1, "A/D/gamma", MOVED_HERE},
+      {2, "A_mv/D_mv/H",      "normal",       1, "A/D/H", MOVED_HERE},
+      {2, "A_mv/D_mv/H/chi",  "normal",       1, "A/D/H/chi", MOVED_HERE},
+      {2, "A_mv/D_mv/H/omega","normal",       1, "A/D/H/omega", MOVED_HERE},
+      {2, "A_mv/D_mv/H/psi",  "normal",       1, "A/D/H/psi", MOVED_HERE},
+      {3, "A_mv/B/E",         "normal",       2, "A/B/E"},
+      {3, "A_mv/B/E/alpha",   "normal",       2, "A/B/E/alpha"},
+      {3, "A_mv/B/E/beta",    "normal",       2, "A/B/E/beta"},
+
+      {0}
+    };
+
+    SVN_ERR(check_db_rows(&b, "", nodes));
+  }
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+move_edit_obstruction(const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+  svn_test__sandbox_t b;
+
+  SVN_ERR(svn_test__sandbox_create(&b, "move_edit_obstruction", opts, pool));
+
+  SVN_ERR(sbox_add_and_commit_greek_tree(&b));
+
+  SVN_ERR(sbox_file_write(&b, "A/B/E/alpha", "Update alpha"));
+  SVN_ERR(sbox_wc_propset(&b, "a", "b", "A/B/F"));
+  SVN_ERR(sbox_wc_commit(&b, "")); /* r2 */
+
+  SVN_ERR(sbox_wc_update(&b, "", 1));
+
+  /* Simple move */
+  SVN_ERR(sbox_wc_move(&b, "A", "A_mv"));
+  SVN_ERR(sbox_wc_update(&b, "", 2));
+  SVN_ERR(sbox_wc_resolve(&b, "A", svn_depth_empty,
+                          svn_wc_conflict_choose_mine_conflict));
+
+  {
+    nodes_row_t nodes[] = {
+      {1, "A_mv",             "normal",       2, "A", MOVED_HERE},
+      {1, "A_mv/B",           "normal",       2, "A/B", MOVED_HERE},
+      {1, "A_mv/B/E",         "normal",       2, "A/B/E", MOVED_HERE},
+      {1, "A_mv/B/E/alpha",   "normal",       2, "A/B/E/alpha", MOVED_HERE},
+      {1, "A_mv/B/E/beta",    "normal",       2, "A/B/E/beta", MOVED_HERE},
+      {1, "A_mv/B/F",         "normal",       2, "A/B/F", MOVED_HERE, "a"},
+      {1, "A_mv/B/lambda",    "normal",       2, "A/B/lambda", MOVED_HERE},
+      {1, "A_mv/C",           "normal",       2, "A/C", MOVED_HERE},
+      {1, "A_mv/D",           "normal",       2, "A/D", MOVED_HERE},
+      {1, "A_mv/D/G",         "normal",       2, "A/D/G", MOVED_HERE},
+      {1, "A_mv/D/G/pi",      "normal",       2, "A/D/G/pi", MOVED_HERE},
+      {1, "A_mv/D/G/rho",     "normal",       2, "A/D/G/rho", MOVED_HERE},
+      {1, "A_mv/D/G/tau",     "normal",       2, "A/D/G/tau", MOVED_HERE},
+      {1, "A_mv/D/gamma",     "normal",       2, "A/D/gamma", MOVED_HERE},
+      {1, "A_mv/D/H",         "normal",       2, "A/D/H", MOVED_HERE},
+      {1, "A_mv/D/H/chi",     "normal",       2, "A/D/H/chi", MOVED_HERE},
+      {1, "A_mv/D/H/omega",   "normal",       2, "A/D/H/omega", MOVED_HERE},
+      {1, "A_mv/D/H/psi",     "normal",       2, "A/D/H/psi", MOVED_HERE},
+      {1, "A_mv/mu",          "normal",       2, "A/mu", MOVED_HERE},
+      {0}
+    };
+
+    SVN_ERR(check_db_rows(&b, "A_mv", nodes));
+    SVN_ERR(check_db_conflicts(&b, "", NULL));
+  }
+
+  /* Now do the same thing with local obstructions on the edited nodes */
+  SVN_ERR(sbox_wc_update(&b, "", 1));
+  SVN_ERR(sbox_wc_revert(&b, "", svn_depth_infinity));
+  SVN_ERR(sbox_wc_move(&b, "A", "A_mv"));
+
+  SVN_ERR(svn_io_remove_file2(sbox_wc_path(&b, "A_mv/B/E/alpha"), FALSE, pool));
+  SVN_ERR(svn_io_dir_make(sbox_wc_path(&b, "A_mv/B/E/alpha"), APR_OS_DEFAULT,
+                          pool));
+  SVN_ERR(svn_io_dir_remove_nonrecursive(sbox_wc_path(&b, "A_mv/B/F"), pool));
+  SVN_ERR(sbox_file_write(&b, "A_mv/B/F", "F file"));
+
+  SVN_ERR(sbox_wc_update(&b, "", 2));
+  SVN_ERR(sbox_wc_resolve(&b, "A", svn_depth_empty,
+                          svn_wc_conflict_choose_mine_conflict));
+
+  {
+    nodes_row_t nodes[] = {
+      {1, "A_mv",             "normal",       2, "A", MOVED_HERE},
+      {1, "A_mv/B",           "normal",       2, "A/B", MOVED_HERE},
+      {1, "A_mv/B/E",         "normal",       2, "A/B/E", MOVED_HERE},
+      {1, "A_mv/B/E/alpha",   "normal",       2, "A/B/E/alpha", MOVED_HERE},
+      {1, "A_mv/B/E/beta",    "normal",       2, "A/B/E/beta", MOVED_HERE},
+      {1, "A_mv/B/F",         "normal",       2, "A/B/F", MOVED_HERE, "a"},
+      {1, "A_mv/B/lambda",    "normal",       2, "A/B/lambda", MOVED_HERE},
+      {1, "A_mv/C",           "normal",       2, "A/C", MOVED_HERE},
+      {1, "A_mv/D",           "normal",       2, "A/D", MOVED_HERE},
+      {1, "A_mv/D/G",         "normal",       2, "A/D/G", MOVED_HERE},
+      {1, "A_mv/D/G/pi",      "normal",       2, "A/D/G/pi", MOVED_HERE},
+      {1, "A_mv/D/G/rho",     "normal",       2, "A/D/G/rho", MOVED_HERE},
+      {1, "A_mv/D/G/tau",     "normal",       2, "A/D/G/tau", MOVED_HERE},
+      {1, "A_mv/D/gamma",     "normal",       2, "A/D/gamma", MOVED_HERE},
+      {1, "A_mv/D/H",         "normal",       2, "A/D/H", MOVED_HERE},
+      {1, "A_mv/D/H/chi",     "normal",       2, "A/D/H/chi", MOVED_HERE},
+      {1, "A_mv/D/H/omega",   "normal",       2, "A/D/H/omega", MOVED_HERE},
+      {1, "A_mv/D/H/psi",     "normal",       2, "A/D/H/psi", MOVED_HERE},
+      {1, "A_mv/mu",          "normal",       2, "A/mu", MOVED_HERE},
+      {0}
+    };
+    conflict_info_t conflicts[] = {
+      { "A_mv/B/E/alpha", FALSE, FALSE, TRUE },
+      { "A_mv/B/F", FALSE, FALSE, TRUE },
+
+      {0}
+    };
+
+    SVN_ERR(check_db_rows(&b, "A_mv", nodes));
+    SVN_ERR(check_db_conflicts(&b, "", conflicts));
+  }
+
+  return SVN_NO_ERROR;
+}
+
 /* ---------------------------------------------------------------------- */
 /* The list of test functions */
 
@@ -10058,7 +10711,7 @@ static struct svn_test_descriptor_t test
                        "commit_moved_descendant"),
     SVN_TEST_OPTS_XFAIL(commit_moved_away_descendant,
                         "commit_moved_away_descendant"),
-    SVN_TEST_OPTS_XFAIL(finite_move_update_bump,
+    SVN_TEST_OPTS_PASS(finite_move_update_bump,
                        "finite_move_update_bump"),
     SVN_TEST_OPTS_PASS(move_away_delete_update,
                        "move_away_delete_update"),
@@ -10106,16 +10759,24 @@ static struct svn_test_descriptor_t test
                        "del4: delete AAA"),
     SVN_TEST_OPTS_PASS(del4_update_add_AAA,
                        "del4: add AAA"),
+    SVN_TEST_OPTS_PASS(del4_update_replace_AAA,
+                       "del4: replace AAA"),
     SVN_TEST_OPTS_PASS(del4_update_delself_AAA,
                        "del4: delete self AAA"),
+    SVN_TEST_OPTS_XFAIL(del4_update_replaceself_AAA,
+                       "del4: replace self AAA"),
     SVN_TEST_OPTS_PASS(move4_update_edit_AAA,
                        "move4: edit AAA"),
     SVN_TEST_OPTS_PASS(move4_update_delete_AAA,
                        "move4: delete AAA"),
     SVN_TEST_OPTS_PASS(move4_update_add_AAA,
                        "move4: add AAA"),
+    SVN_TEST_OPTS_PASS(move4_update_replace_AAA,
+                       "move4: replace AAA"),
     SVN_TEST_OPTS_PASS(move4_update_delself_AAA,
                        "move4: delete self AAA"),
+    SVN_TEST_OPTS_XFAIL(move4_update_replaceself_AAA,
+                       "move4: replace self AAA"),
     SVN_TEST_OPTS_PASS(simple_move_bump,
                        "simple move bump"),
     SVN_TEST_OPTS_PASS(movedhere_extract_retract,
@@ -10126,6 +10787,10 @@ static struct svn_test_descriptor_t test
                        "break move in delete (issue 4491)"),
     SVN_TEST_OPTS_PASS(nested_move_delete,
                        "nested move delete"),
+    SVN_TEST_OPTS_XFAIL(move_within_mixed_move,
+                        "move within mixed move"),
+    SVN_TEST_OPTS_PASS(move_edit_obstruction,
+                       "move edit obstruction"),
     SVN_TEST_NULL
   };