Modified: subversion/branches/move-tracking-2/subversion/libsvn_subr/x509info.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_subr/x509info.c?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_subr/x509info.c 
(original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_subr/x509info.c Mon 
Feb 16 17:40:07 2015
@@ -168,7 +168,7 @@ svn_x509_oid_to_string(const unsigned ch
       }
     else if (*p < 128)
       {
-        /* The remaining values if they're less than 128 are just 
+        /* The remaining values if they're less than 128 are just
          * the number one to one encoded */
         temp = apr_psprintf(scratch_pool, ".%d", *p);
         p++;

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/conflicts.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/conflicts.c?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/conflicts.c 
(original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/conflicts.c Mon 
Feb 16 17:40:07 2015
@@ -1365,18 +1365,24 @@ generate_propconflict(svn_boolean_t *con
         {
           svn_stringbuf_t *merged_stringbuf;
 
-          if (!cdesc->merged_file && !result->merged_file)
+          if (!cdesc->merged_file 
+              && (!result->merged_file && !result->merged_value))
             return svn_error_create
                 (SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE,
                  NULL, _("Conflict callback violated API:"
                          " returned no merged file"));
 
-          SVN_ERR(svn_stringbuf_from_file2(&merged_stringbuf,
-                                           result->merged_file ?
-                                                result->merged_file :
-                                                cdesc->merged_file,
-                                           scratch_pool));
-          new_value = svn_stringbuf__morph_into_string(merged_stringbuf);
+          if (result->merged_value)
+            new_value = result->merged_value;
+          else
+            {
+              SVN_ERR(svn_stringbuf_from_file2(&merged_stringbuf,
+                                               result->merged_file ?
+                                                    result->merged_file :
+                                                    cdesc->merged_file,
+                                               scratch_pool));
+              new_value = svn_stringbuf__morph_into_string(merged_stringbuf);
+            }
           *conflict_remains = FALSE;
           break;
         }
@@ -1772,6 +1778,7 @@ static svn_error_t *
 read_tree_conflict_desc(svn_wc_conflict_description2_t **desc,
                         svn_wc__db_t *db,
                         const char *local_abspath,
+                        svn_node_kind_t node_kind,
                         const svn_skel_t *conflict_skel,
                         svn_wc_operation_t operation,
                         const svn_wc_conflict_version_t *left_version,
@@ -1792,49 +1799,18 @@ read_tree_conflict_desc(svn_wc_conflict_
   else if (reason == svn_wc_conflict_reason_unversioned ||
            reason == svn_wc_conflict_reason_obstructed)
     SVN_ERR(svn_io_check_path(local_abspath, &local_kind, scratch_pool));
-  else if (operation == svn_wc_operation_merge)
+  else if (action == svn_wc_conflict_action_delete
+           && left_version
+           && (operation == svn_wc_operation_update
+               ||operation == svn_wc_operation_switch)
+           && (reason == svn_wc_conflict_reason_deleted
+               || reason == svn_wc_conflict_reason_moved_away))
     {
-      /* ### If the merge replaced the node, this will read the kind of
-       * ### the merge-right node, which is not necessarily the node
-       * ### kind of the tree conflict victim.
-       * ### This needs the BASE node kind if the node was not replaced
-       * ### at the time the merge was run. But if the node was already
-       * ### replaced before the merge, it needs the kind of the replacing
-       * ### node. Ideally, we'd store the victim node kind in conflict
-       * ### storage instead of guessing it here...
-       */
-      /* Read the tree conflict victim's node kind from the working copy,
-         or if it doesn't exist directly from disk. */
-      SVN_ERR(svn_wc__db_read_kind(&local_kind, db, local_abspath,
-                                   TRUE /* allow missing */,
-                                   FALSE /* show deleted */,
-                                   FALSE /* show hidden */, scratch_pool));
-
-      if (local_kind == svn_node_unknown || local_kind == svn_node_none)
-        SVN_ERR(svn_io_check_path(local_abspath, &local_kind, scratch_pool));
-    }
-  else if (operation == svn_wc_operation_update ||
-           operation == svn_wc_operation_switch)
-    {
-      /* For updates, the left version corresponds to the pre-update state. */
-      if (left_version)
-        local_kind = left_version->node_kind;
-      else
-        {
-          /* No left version is available, so the conflict was flagged
-           * because of a locally added node which was not part of the
-           * BASE tree before the update. */
-          SVN_ERR(svn_wc__db_read_kind(&local_kind, db, local_abspath,
-                                       TRUE /* allow missing */,
-                                       TRUE /* show deleted */,
-                                       FALSE /* show hidden */, scratch_pool));
-          if (local_kind == svn_node_unknown || local_kind == svn_node_none)
-            SVN_ERR(svn_io_check_path(local_abspath, &local_kind,
-                                      scratch_pool));
-        }
+      /* We have nothing locally to take the kind from */
+      local_kind = left_version->node_kind;
     }
   else
-    SVN_ERR_MALFUNCTION();
+    local_kind = node_kind;
 
   *desc = svn_wc_conflict_description_create_tree2(local_abspath, local_kind,
                                                    operation,
@@ -2029,9 +2005,14 @@ svn_wc__conflict_invoke_resolver(svn_wc_
       svn_wc_conflict_result_t *result;
       svn_wc_conflict_description2_t *desc;
       svn_boolean_t resolved;
+      svn_node_kind_t node_kind;
+
+      SVN_ERR(svn_wc__db_read_kind(&node_kind, db, local_abspath, TRUE,
+                                   TRUE, FALSE, scratch_pool));
 
       SVN_ERR(read_tree_conflict_desc(&desc,
-                                      db, local_abspath, conflict_skel,
+                                      db, local_abspath, node_kind,
+                                      conflict_skel,
                                       operation, left_version, right_version,
                                       scratch_pool, scratch_pool));
 
@@ -2126,8 +2107,8 @@ read_prop_conflict_descs(apr_array_heade
       return SVN_NO_ERROR;
     }
 
-  SVN_ERR(svn_wc__db_base_get_props(&base_props, db, local_abspath,
-                                    result_pool, scratch_pool));
+  SVN_ERR(svn_wc__db_read_pristine_props(&base_props, db, local_abspath,
+                                         result_pool, scratch_pool));
   iterpool = svn_pool_create(scratch_pool);
   for (hi = apr_hash_first(scratch_pool, conflicted_props);
        hi;
@@ -2250,8 +2231,10 @@ svn_wc__read_conflicts(const apr_array_h
   const apr_array_header_t *locations;
   const svn_wc_conflict_version_t *left_version = NULL;
   const svn_wc_conflict_version_t *right_version = NULL;
+  svn_node_kind_t node_kind;
 
-  SVN_ERR(svn_wc__db_read_conflict(&conflict_skel, db, local_abspath,
+  SVN_ERR(svn_wc__db_read_conflict(&conflict_skel, &node_kind,
+                                   db, local_abspath,
                                    scratch_pool, scratch_pool));
 
   if (!conflict_skel)
@@ -2277,9 +2260,6 @@ svn_wc__read_conflicts(const apr_array_h
 
   if (prop_conflicted)
     {
-      svn_node_kind_t node_kind
-        = left_version ? left_version->node_kind : svn_node_unknown;
-
       SVN_ERR(read_prop_conflict_descs(cflcts,
                                        db, local_abspath, conflict_skel,
                                        create_tempfiles, node_kind,
@@ -2304,7 +2284,8 @@ svn_wc__read_conflicts(const apr_array_h
       svn_wc_conflict_description2_t *desc;
 
       SVN_ERR(read_tree_conflict_desc(&desc,
-                                      db, local_abspath, conflict_skel,
+                                      db, local_abspath, node_kind,
+                                      conflict_skel,
                                       operation, left_version, right_version,
                                       result_pool, scratch_pool));
 
@@ -2357,9 +2338,11 @@ static svn_error_t *
 resolve_prop_conflict_on_node(svn_boolean_t *did_resolve,
                               svn_wc__db_t *db,
                               const char *local_abspath,
+                              const svn_skel_t *conflicts,
                               const char *conflicted_propname,
                               svn_wc_conflict_choice_t conflict_choice,
                               const char *merged_file,
+                              const svn_string_t *merged_value,
                               svn_cancel_func_t cancel_func,
                               void *cancel_baton,
                               apr_pool_t *scratch_pool)
@@ -2372,18 +2355,11 @@ resolve_prop_conflict_on_node(svn_boolea
   apr_hash_t *old_props;
   apr_hash_t *resolve_from = NULL;
   svn_skel_t *work_items = NULL;
-  svn_skel_t *conflicts;
   svn_wc_operation_t operation;
   svn_boolean_t prop_conflicted;
 
   *did_resolve = FALSE;
 
-  SVN_ERR(svn_wc__db_read_conflict(&conflicts, db, local_abspath,
-                                   scratch_pool, scratch_pool));
-
-  if (!conflicts)
-    return SVN_NO_ERROR;
-
   SVN_ERR(svn_wc__conflict_read_info(&operation, NULL, NULL, &prop_conflicted,
                                      NULL, db, local_abspath, conflicts,
                                      scratch_pool, scratch_pool));
@@ -2427,21 +2403,27 @@ resolve_prop_conflict_on_node(svn_boolea
       resolve_from = their_props;
       break;
     case svn_wc_conflict_choose_merged:
-      if (merged_file && conflicted_propname[0] != '\0')
+      if ((merged_file || merged_value) && conflicted_propname[0] != '\0')
         {
           apr_hash_t *actual_props;
-          svn_stream_t *stream;
-          svn_string_t *merged_propval;
 
           SVN_ERR(svn_wc__db_read_props(&actual_props, db, local_abspath,
                                         scratch_pool, scratch_pool));
           resolve_from = actual_props;
 
-          SVN_ERR(svn_stream_open_readonly(&stream, merged_file,
-                                           scratch_pool, scratch_pool));
-          SVN_ERR(svn_string_from_stream(&merged_propval, stream,
-                                         scratch_pool, scratch_pool));
-          svn_hash_sets(resolve_from, conflicted_propname, merged_propval);
+          if (!merged_value)
+            {
+              svn_stream_t *stream;
+              svn_string_t *merged_propval;
+
+              SVN_ERR(svn_stream_open_readonly(&stream, merged_file,
+                                               scratch_pool, scratch_pool));
+              SVN_ERR(svn_string_from_stream(&merged_propval, stream,
+                                             scratch_pool, scratch_pool));
+
+              merged_value = merged_propval;
+            }
+          svn_hash_sets(resolve_from, conflicted_propname, merged_value);
         }
       else
         resolve_from = NULL;
@@ -2727,7 +2709,7 @@ svn_wc__mark_resolved_text_conflict(svn_
   svn_skel_t *work_items;
   svn_skel_t *conflict;
 
-  SVN_ERR(svn_wc__db_read_conflict(&conflict, db, local_abspath,
+  SVN_ERR(svn_wc__db_read_conflict(&conflict, NULL, db, local_abspath,
                                    scratch_pool, scratch_pool));
 
   if (!conflict)
@@ -2754,11 +2736,19 @@ svn_wc__mark_resolved_prop_conflicts(svn
                                      apr_pool_t *scratch_pool)
 {
   svn_boolean_t ignored_result;
+  svn_skel_t *conflicts;
+
+  SVN_ERR(svn_wc__db_read_conflict(&conflicts, NULL, db, local_abspath,
+                                   scratch_pool, scratch_pool));
+
+  if (!conflicts)
+    return SVN_NO_ERROR;
 
   return svn_error_trace(resolve_prop_conflict_on_node(
                            &ignored_result,
-                           db, local_abspath, "",
-                           svn_wc_conflict_choose_merged, NULL,
+                           db, local_abspath, conflicts, "",
+                           svn_wc_conflict_choose_merged,
+                           NULL, NULL,
                            NULL, NULL,
                            scratch_pool));
 }
@@ -2832,7 +2822,7 @@ conflict_status_walker(void *baton,
 
   iterpool = svn_pool_create(scratch_pool);
 
-  SVN_ERR(svn_wc__db_read_conflict(&conflict, db, local_abspath,
+  SVN_ERR(svn_wc__db_read_conflict(&conflict, NULL, db, local_abspath,
                                    scratch_pool, scratch_pool));
 
   SVN_ERR(svn_wc__read_conflicts(&conflicts, db, local_abspath, TRUE,
@@ -2848,7 +2838,10 @@ conflict_status_walker(void *baton,
 
       cd = APR_ARRAY_IDX(conflicts, i, const svn_wc_conflict_description2_t *);
 
-      if ((cd->kind == svn_wc_conflict_kind_property && !cswb->resolve_prop)
+      if ((cd->kind == svn_wc_conflict_kind_property
+           && (!cswb->resolve_prop
+               || (*cswb->resolve_prop != '\0'
+                   && strcmp(cswb->resolve_prop, cd->property_name) != 0)))
           || (cd->kind == svn_wc_conflict_kind_text && !cswb->resolve_text)
           || (cd->kind == svn_wc_conflict_kind_tree && !cswb->resolve_tree))
         {
@@ -2877,8 +2870,6 @@ conflict_status_walker(void *baton,
       switch (cd->kind)
         {
           case svn_wc_conflict_kind_tree:
-            if (!cswb->resolve_tree)
-              break;
             SVN_ERR(resolve_tree_conflict_on_node(&did_resolve,
                                                   db,
                                                   local_abspath, conflict,
@@ -2895,9 +2886,6 @@ conflict_status_walker(void *baton,
             break;
 
           case svn_wc_conflict_kind_text:
-            if (!cswb->resolve_text)
-              break;
-
             SVN_ERR(build_text_conflict_resolve_items(
                                         &work_items,
                                         &resolved,
@@ -2921,23 +2909,18 @@ conflict_status_walker(void *baton,
             break;
 
           case svn_wc_conflict_kind_property:
-            if (!cswb->resolve_prop)
-              break;
-
-            if (*cswb->resolve_prop != '\0' &&
-                strcmp(cswb->resolve_prop, cd->property_name) != 0)
-              {
-                break; /* This is not the property we want to resolve. */
-              }
-
             SVN_ERR(resolve_prop_conflict_on_node(&did_resolve,
                                                   db,
                                                   local_abspath,
+                                                  conflict,
                                                   cd->property_name,
                                                   my_choice,
                                                   result
                                                     ? result->merged_file
                                                     : NULL,
+                                                  result
+                                                    ? result->merged_value
+                                                    : NULL,
                                                   cswb->cancel_func,
                                                   cswb->cancel_baton,
                                                   iterpool));
@@ -3141,7 +3124,7 @@ svn_wc_create_conflict_result(svn_wc_con
 {
   svn_wc_conflict_result_t *result = apr_pcalloc(pool, sizeof(*result));
   result->choice = choice;
-  result->merged_file = merged_file;
+  result->merged_file = apr_pstrdup(pool, merged_file);
   result->save_merged = FALSE;
 
   /* If we add more fields to svn_wc_conflict_result_t, add them here. */

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/copy.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/copy.c?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/copy.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/copy.c Mon Feb 16 
17:40:07 2015
@@ -258,7 +258,7 @@ copy_versioned_file(svn_wc__db_t *db,
           svn_error_t *err;
 
           /* Is there a text conflict at the source path? */
-          SVN_ERR(svn_wc__db_read_conflict(&conflict, db, src_abspath,
+          SVN_ERR(svn_wc__db_read_conflict(&conflict, NULL, db, src_abspath,
                                          scratch_pool, scratch_pool));
 
           err = svn_wc__conflict_read_text_conflict(&conflict_working, NULL, 
NULL,
@@ -945,7 +945,7 @@ remove_node_conflict_markers(svn_wc__db_
 {
   svn_skel_t *conflict;
 
-  SVN_ERR(svn_wc__db_read_conflict(&conflict, db, src_abspath,
+  SVN_ERR(svn_wc__db_read_conflict(&conflict, NULL, db, src_abspath,
                                    scratch_pool, scratch_pool));
 
   /* Do we have conflict markers that should be removed? */

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/delete.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/delete.c?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/delete.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/delete.c Mon Feb 
16 17:40:07 2015
@@ -135,7 +135,7 @@ create_delete_wq_items(svn_skel_t **work
       const apr_array_header_t *markers;
       int i;
 
-      SVN_ERR(svn_wc__db_read_conflict(&conflict, db, local_abspath,
+      SVN_ERR(svn_wc__db_read_conflict(&conflict, NULL, db, local_abspath,
                                        scratch_pool, scratch_pool));
 
       SVN_ERR(svn_wc__conflict_read_markers(&markers, db, local_abspath,

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/diff.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/diff.h?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/diff.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/diff.h Mon Feb 16 
17:40:07 2015
@@ -39,7 +39,7 @@ extern "C" {
 #endif /* __cplusplus */
 
 /* A function to diff locally added and locally copied files.
-  
+
    Reports the file LOCAL_ABSPATH as ADDED file with relpath RELPATH to
    PROCESSOR with as parent baton PROCESSOR_PARENT_BATON.
 
@@ -60,7 +60,7 @@ svn_wc__diff_local_only_file(svn_wc__db_
                              apr_pool_t *scratch_pool);
 
 /* A function to diff locally added and locally copied directories.
-  
+
    Reports the directory LOCAL_ABSPATH and everything below it (limited by
    DEPTH) as added with relpath RELPATH to PROCESSOR with as parent baton
    PROCESSOR_PARENT_BATON.

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/entries.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/entries.c?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/entries.c 
(original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/entries.c Mon Feb 
16 17:40:07 2015
@@ -881,7 +881,7 @@ read_one_entry(const svn_wc_entry_t **ne
       svn_skel_t *conflict;
       svn_boolean_t text_conflicted;
       svn_boolean_t prop_conflicted;
-      SVN_ERR(svn_wc__db_read_conflict(&conflict, db, entry_abspath,
+      SVN_ERR(svn_wc__db_read_conflict(&conflict, NULL, db, entry_abspath,
                                        scratch_pool, scratch_pool));
 
       SVN_ERR(svn_wc__conflict_read_info(NULL, NULL, &text_conflicted,

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/externals.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/externals.c?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/externals.c 
(original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/externals.c Mon 
Feb 16 17:40:07 2015
@@ -68,6 +68,7 @@
  * the revision if the revision is found.  Set REV_IDX to the index in
  * LINE_PARTS where the revision specification starts.  Remove from
  * LINE_PARTS the element(s) that specify the revision.
+ * Set REV_STR to the element that specifies the revision.
  * PARENT_DIRECTORY_DISPLAY and LINE are given to return a nice error
  * string.
  *
@@ -76,6 +77,7 @@
  */
 static svn_error_t *
 find_and_remove_externals_revision(int *rev_idx,
+                                   const char **rev_str,
                                    const char **line_parts,
                                    int num_line_parts,
                                    svn_wc_external_item2_t *item,
@@ -137,6 +139,8 @@ find_and_remove_externals_revision(int *
             line_parts[j] = line_parts[j+shift_count];
           line_parts[num_line_parts-shift_count] = NULL;
 
+          *rev_str = apr_psprintf(pool, "-r%s", digits_ptr);
+
           /* Found the revision, so leave the function immediately, do
            * not continue looking for additional revisions. */
           return SVN_NO_ERROR;
@@ -158,7 +162,8 @@ find_and_remove_externals_revision(int *
 }
 
 svn_error_t *
-svn_wc_parse_externals_description3(apr_array_header_t **externals_p,
+svn_wc__parse_externals_description(apr_array_header_t **externals_p,
+                                    apr_array_header_t **parser_infos_p,
                                     const char *defining_directory,
                                     const char *desc,
                                     svn_boolean_t canonicalize_url,
@@ -166,6 +171,7 @@ svn_wc_parse_externals_description3(apr_
 {
   int i;
   apr_array_header_t *externals = NULL;
+  apr_array_header_t *parser_infos = NULL;
   apr_array_header_t *lines = svn_cstring_split(desc, "\n\r", TRUE, pool);
   const char *defining_directory_display = svn_path_is_url(defining_directory) 
?
     defining_directory : svn_dirent_local_style(defining_directory, pool);
@@ -175,6 +181,10 @@ svn_wc_parse_externals_description3(apr_
   if (externals_p)
     externals = apr_array_make(pool, 1, sizeof(svn_wc_external_item2_t *));
 
+  if (parser_infos_p)
+    parser_infos =
+      apr_array_make(pool, 1, sizeof(svn_wc__externals_parser_info_t *));
+
   for (i = 0; i < lines->nelts; i++)
     {
       const char *line = APR_ARRAY_IDX(lines, i, const char *);
@@ -186,10 +196,12 @@ svn_wc_parse_externals_description3(apr_
       const char *token1;
       svn_boolean_t token0_is_url;
       svn_boolean_t token1_is_url;
+      svn_wc__externals_parser_info_t *info = NULL;
 
       /* Index into line_parts where the revision specification
          started. */
       int rev_idx = -1;
+      const char *rev_str = NULL;
 
       if ((! line) || (line[0] == '#'))
         continue;
@@ -209,6 +221,9 @@ svn_wc_parse_externals_description3(apr_
       item->revision.kind = svn_opt_revision_unspecified;
       item->peg_revision.kind = svn_opt_revision_unspecified;
 
+      if (parser_infos)
+        info = apr_pcalloc(pool, sizeof(*info));
+
       /*
        * There are six different formats of externals:
        *
@@ -240,6 +255,7 @@ svn_wc_parse_externals_description3(apr_
          set item->revision to the parsed revision. */
       /* ### ugh. stupid cast. */
       SVN_ERR(find_and_remove_externals_revision(&rev_idx,
+                                                 &rev_str,
                                                  (const char **)line_parts,
                                                  num_line_parts, item,
                                                  defining_directory_display,
@@ -290,12 +306,34 @@ svn_wc_parse_externals_description3(apr_
           SVN_ERR(svn_opt_parse_path(&item->peg_revision, &item->url,
                                      token0, pool));
           item->target_dir = token1;
+
+          if (info)
+            {
+              info->format = svn_wc__external_description_format_2;
+
+              if (rev_str)
+                info->rev_str = apr_pstrdup(pool, rev_str);
+
+              if (item->peg_revision.kind != svn_opt_revision_unspecified)
+                info->peg_rev_str = strrchr(token0, '@');
+            }
         }
       else
         {
           item->target_dir = token0;
           item->url = token1;
           item->peg_revision = item->revision;
+
+          if (info)
+            {
+              info->format = svn_wc__external_description_format_1;
+
+              if (rev_str)
+                {
+                  info->rev_str = apr_pstrdup(pool, rev_str);
+                  info->peg_rev_str = info->rev_str;
+                }
+            }
         }
 
       SVN_ERR(svn_opt_resolve_revisions(&item->peg_revision,
@@ -333,15 +371,34 @@ svn_wc_parse_externals_description3(apr_
 
       if (externals)
         APR_ARRAY_PUSH(externals, svn_wc_external_item2_t *) = item;
+      if (parser_infos)
+        APR_ARRAY_PUSH(parser_infos, svn_wc__externals_parser_info_t *) = info;
     }
 
   if (externals_p)
     *externals_p = externals;
+  if (parser_infos_p)
+    *parser_infos_p = parser_infos;
 
   return SVN_NO_ERROR;
 }
 
 svn_error_t *
+svn_wc_parse_externals_description3(apr_array_header_t **externals_p,
+                                    const char *defining_directory,
+                                    const char *desc,
+                                    svn_boolean_t canonicalize_url,
+                                    apr_pool_t *pool)
+{
+  return svn_error_trace(svn_wc__parse_externals_description(externals_p,
+                                                             NULL,
+                                                             
defining_directory,
+                                                             desc,
+                                                             canonicalize_url,
+                                                             pool));
+}
+
+svn_error_t *
 svn_wc__externals_find_target_dups(apr_array_header_t **duplicate_targets,
                                    apr_array_header_t *externals,
                                    apr_pool_t *pool,

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/props.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/props.c?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/props.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/props.c Mon Feb 16 
17:40:07 2015
@@ -541,7 +541,7 @@ prop_conflict_new(const svn_string_t **c
 
   /* How we render the conflict:
 
-     We have four sides: original, mine, incoming_base, incoming.  
+     We have four sides: original, mine, incoming_base, incoming.
      We render the conflict as a 3-way diff.  A diff3 API has three parts,
      called:
 
@@ -750,7 +750,7 @@ svn_wc__create_prejfile(const char **tmp
       apr_hash_t *conflicted_props;
       svn_skel_t *conflicts;
 
-      SVN_ERR(svn_wc__db_read_conflict(&conflicts, db, local_abspath,
+      SVN_ERR(svn_wc__db_read_conflict(&conflicts, NULL, db, local_abspath,
                                       scratch_pool, scratch_pool));
 
       SVN_ERR(svn_wc__conflict_read_info(&operation, NULL, NULL, NULL, NULL,

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/questions.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/questions.c?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/questions.c 
(original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/questions.c Mon 
Feb 16 17:40:07 2015
@@ -369,7 +369,7 @@ internal_conflicted_p(svn_boolean_t *tex
   svn_boolean_t resolved_text = FALSE;
   svn_boolean_t resolved_props = FALSE;
 
-  SVN_ERR(svn_wc__db_read_conflict(&conflicts, db, local_abspath,
+  SVN_ERR(svn_wc__db_read_conflict(&conflicts, NULL, db, local_abspath,
                                    scratch_pool, scratch_pool));
 
   if (!conflicts)

Modified: 
subversion/branches/move-tracking-2/subversion/libsvn_wc/update_editor.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/update_editor.c?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/update_editor.c 
(original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/update_editor.c 
Mon Feb 16 17:40:07 2015
@@ -825,10 +825,11 @@ complete_conflict(svn_skel_t *conflict,
                   const char *new_repos_relpath,
                   svn_node_kind_t local_kind,
                   svn_node_kind_t target_kind,
+                  const svn_skel_t *delete_conflict,
                   apr_pool_t *result_pool,
                   apr_pool_t *scratch_pool)
 {
-  svn_wc_conflict_version_t *original_version;
+  const svn_wc_conflict_version_t *original_version = NULL;
   svn_wc_conflict_version_t *target_version;
   svn_boolean_t is_complete;
 
@@ -849,8 +850,21 @@ complete_conflict(svn_skel_t *conflict,
                                                        old_revision,
                                                        local_kind,
                                                        result_pool);
-  else
-    original_version = NULL;
+  else if (delete_conflict)
+    {
+      const apr_array_header_t *locations;
+
+      SVN_ERR(svn_wc__conflict_read_info(NULL, &locations, NULL, NULL, NULL,
+                                         eb->db, local_abspath,
+                                         delete_conflict,
+                                         scratch_pool, scratch_pool));
+
+      if (locations)
+        {
+          original_version = APR_ARRAY_IDX(locations, 0,
+                                           const svn_wc_conflict_version_t *);
+        }
+    }
 
   target_version = svn_wc_conflict_version_create2(eb->repos_root,
                                                    eb->repos_uuid,
@@ -896,6 +910,7 @@ mark_directory_edited(struct dir_baton *
                                 db->old_repos_relpath, db->old_revision,
                                 db->new_repos_relpath,
                                 svn_node_dir, svn_node_dir,
+                                NULL,
                                 db->pool, scratch_pool));
       SVN_ERR(svn_wc__db_op_mark_conflict(db->edit_baton->db,
                                           db->local_abspath,
@@ -930,6 +945,7 @@ mark_file_edited(struct file_baton *fb,
                                 fb->local_abspath, fb->old_repos_relpath,
                                 fb->old_revision, fb->new_repos_relpath,
                                 svn_node_file, svn_node_file,
+                                NULL,
                                 fb->pool, scratch_pool));
 
       SVN_ERR(svn_wc__db_op_mark_conflict(fb->edit_baton->db,
@@ -1249,7 +1265,7 @@ open_root(void *edit_baton,
                                         db->old_revision,
                                         db->new_repos_relpath,
                                         svn_node_dir, svn_node_dir,
-                                        pool, pool));
+                                        NULL, pool, pool));
               SVN_ERR(svn_wc__db_op_mark_conflict(eb->db,
                                                   move_src_root_abspath,
                                                   tree_conflict,
@@ -1878,10 +1894,7 @@ delete_entry(const char *path,
                                   scratch_pool));
   SVN_ERR(complete_conflict(tree_conflict, eb, local_abspath, repos_relpath,
                             old_revision, deleted_repos_relpath,
-                            (kind == svn_node_dir)
-                                ? svn_node_dir
-                                : svn_node_file,
-                            svn_node_none,
+                            kind, svn_node_none, NULL,
                             pb->pool, scratch_pool));
 
   /* Issue a wq operation to delete the BASE_NODE data and to delete actual
@@ -1934,23 +1947,17 @@ delete_entry(const char *path,
                                                  eb->cancel_func,
                                                  eb->cancel_baton,
                                                  scratch_pool));
-      do_notification(eb, local_abspath, svn_node_unknown,
+      do_notification(eb, local_abspath, kind,
                       svn_wc_notify_tree_conflict, scratch_pool);
     }
   else
     {
       svn_wc_notify_action_t action = svn_wc_notify_update_delete;
-      svn_node_kind_t node_kind;
 
       if (pb->shadowed || pb->edit_obstructed)
         action = svn_wc_notify_update_shadowed_delete;
 
-      if (kind == svn_node_dir)
-        node_kind = svn_node_dir;
-      else
-        node_kind = svn_node_file;
-
-      do_notification(eb, local_abspath, node_kind, action, scratch_pool);
+      do_notification(eb, local_abspath, kind, action, scratch_pool);
     }
 
   svn_pool_destroy(scratch_pool);
@@ -2117,7 +2124,7 @@ add_directory(const char *path,
              replacement. Let's install a better tree conflict. */
 
           SVN_ERR(svn_wc__conflict_read_tree_conflict(&reason, NULL,
-                                                     &move_src_op_root_abspath,
+                                                      
&move_src_op_root_abspath,
                                                       eb->db,
                                                       db->local_abspath,
                                                       tree_conflict,
@@ -2264,8 +2271,11 @@ add_directory(const char *path,
     SVN_ERR(complete_conflict(tree_conflict, eb, db->local_abspath,
                               db->old_repos_relpath, db->old_revision,
                               db->new_repos_relpath,
-                              wc_kind,
-                              svn_node_dir,
+                              wc_kind, svn_node_dir,
+                              pb->deletion_conflicts
+                                ? svn_hash_gets(pb->deletion_conflicts,
+                                                db->name)
+                                : NULL,
                               db->pool, scratch_pool));
 
   SVN_ERR(svn_wc__db_base_add_incomplete_directory(
@@ -2858,6 +2868,11 @@ close_directory(void *dir_baton,
                                     db->old_revision,
                                     db->new_repos_relpath,
                                     svn_node_dir, svn_node_dir,
+                                    db->parent_baton->deletion_conflicts
+                                      ? svn_hash_gets(
+                                            
db->parent_baton->deletion_conflicts,
+                                            db->name)
+                                      : NULL,
                                     db->pool, scratch_pool));
 
           SVN_ERR(svn_wc__conflict_create_markers(&work_item,
@@ -3081,9 +3096,8 @@ absent_node(const char *path,
     if (tree_conflict)
       SVN_ERR(complete_conflict(tree_conflict, eb, local_abspath,
                                 NULL, SVN_INVALID_REVNUM, repos_relpath,
-                                kind, svn_node_unknown,
+                                kind, svn_node_unknown, NULL,
                                 scratch_pool, scratch_pool));
-                                
 
     /* Insert an excluded node below the parent node to note that this child
        is absent. (This puts it in the parent db if the child is obstructed) */
@@ -3282,7 +3296,7 @@ add_file(const char *path,
              replacement. Let's install a better tree conflict. */
 
           SVN_ERR(svn_wc__conflict_read_tree_conflict(&reason, NULL,
-                                                     &move_src_op_root_abspath,
+                                                      
&move_src_op_root_abspath,
                                                       eb->db,
                                                       fb->local_abspath,
                                                       tree_conflict,
@@ -3445,8 +3459,11 @@ add_file(const char *path,
                                 fb->old_repos_relpath,
                                 fb->old_revision,
                                 fb->new_repos_relpath,
-                                wc_kind,
-                                svn_node_file,
+                                wc_kind, svn_node_file,
+                                pb->deletion_conflicts
+                                  ? svn_hash_gets(pb->deletion_conflicts,
+                                                  fb->name)
+                                  : NULL,
                                 fb->pool, scratch_pool));
 
       SVN_ERR(svn_wc__db_op_mark_conflict(eb->db,
@@ -3851,7 +3868,7 @@ change_file_prop(void *file_baton,
                                     fb->local_abspath, fb->old_repos_relpath,
                                     fb->old_revision, fb->new_repos_relpath,
                                     svn_node_file, svn_node_file,
-                                    fb->pool, scratch_pool));
+                                    NULL, fb->pool, scratch_pool));
 
           /* Create a copy of the existing (pre update) BASE node in WORKING,
              mark a tree conflict and handle the rest of the update as
@@ -4564,6 +4581,11 @@ close_file(void *file_baton,
                                 fb->old_revision,
                                 fb->new_repos_relpath,
                                 svn_node_file, svn_node_file,
+                                fb->dir_baton->deletion_conflicts
+                                  ? svn_hash_gets(
+                                        fb->dir_baton->deletion_conflicts,
+                                        fb->name)
+                                  : NULL,
                                 fb->pool, scratch_pool));
 
       SVN_ERR(svn_wc__conflict_create_markers(&work_item,
@@ -4734,7 +4756,7 @@ update_keywords_after_switch_cb(void *ba
       install_from = NULL;
       record_fileinfo = TRUE;
     }
-    
+
   SVN_ERR(svn_wc__wq_build_file_install(&work_items, eb->db, local_abspath,
                                         install_from,
                                         eb->use_commit_times,
@@ -4858,7 +4880,7 @@ close_edit(void *edit_baton,
   if (eb->switch_repos_relpath)
     {
       svn_depth_t depth;
-      
+
       if (eb->requested_depth > svn_depth_empty)
         depth = eb->requested_depth;
       else

Modified: 
subversion/branches/move-tracking-2/subversion/libsvn_wc/wc-metadata.sql
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/wc-metadata.sql?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/wc-metadata.sql 
(original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/wc-metadata.sql 
Mon Feb 16 17:40:07 2015
@@ -108,7 +108,7 @@ CREATE TABLE PRISTINE (
   );
 
 CREATE INDEX I_PRISTINE_MD5 ON PRISTINE (md5_checksum);
-  
+
 /* ------------------------------------------------------------------------- */
 
 /* The ACTUAL_NODE table describes text changes and property changes
@@ -150,7 +150,7 @@ CREATE TABLE ACTUAL_NODE (
 
   /* if not NULL, this node is part of a changelist. */
   changelist  TEXT,
-  
+
   /* ### need to determine values. "unknown" (no info), "admin" (they
      ### used something like 'svn edit'), "noticed" (saw a mod while
      ### scanning the filesystem). */
@@ -170,7 +170,7 @@ CREATE TABLE ACTUAL_NODE (
   /* stsp: This is meant for text conflicts, right? What about property
            conflicts? Why do we need these in a column to refer to the
            pristine store? Can't we just parse the checksums from
-           conflict_data as well? 
+           conflict_data as well?
      rhuijben: Because that won't allow triggers to handle refcounts.
                We would have to scan all conflict skels before cleaning up the
                a single file from the pristine stor */
@@ -200,7 +200,7 @@ CREATE TABLE LOCK (
   lock_owner  TEXT,
   lock_comment  TEXT,
   lock_date  INTEGER,   /* an APR date/time (usec since 1970) */
-  
+
   PRIMARY KEY (repos_id, repos_relpath)
   );
 
@@ -553,7 +553,7 @@ CREATE TABLE EXTERNALS (
   /* the kind of the external. */
   kind  TEXT NOT NULL,
 
-  /* The local relpath of the directory NODE defining this external 
+  /* The local relpath of the directory NODE defining this external
      (Defaults to the parent directory of the file external after upgrade) */
   def_local_relpath         TEXT NOT NULL,
 
@@ -774,7 +774,7 @@ LIMIT 1
 
 /* ------------------------------------------------------------------------- */
 
-/* Format 28 involves no schema changes, it only converts MD5 pristine 
+/* Format 28 involves no schema changes, it only converts MD5 pristine
    references to SHA1. */
 
 -- STMT_UPGRADE_TO_28

Modified: 
subversion/branches/move-tracking-2/subversion/libsvn_wc/wc-queries.sql
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/wc-queries.sql?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/wc-queries.sql 
(original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/wc-queries.sql Mon 
Feb 16 17:40:07 2015
@@ -253,7 +253,7 @@ WHERE wc_id = ?1 AND IS_STRICT_DESCENDAN
 
 -- STMT_DELETE_WORKING_OP_DEPTH
 DELETE FROM nodes
-WHERE wc_id = ?1 
+WHERE wc_id = ?1
   AND (local_relpath = ?2 OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth = ?3
 
@@ -262,15 +262,12 @@ The op_root must exist (or there is no l
    always has presence 'normal' */
 -- STMT_SELECT_LAYER_FOR_REPLACE
 SELECT s.local_relpath, s.kind,
-  RELPATH_SKIP_JOIN(?2, ?4, s.local_relpath) drp, 'normal', 0
+  RELPATH_SKIP_JOIN(?2, ?4, s.local_relpath) drp, 'normal'
 FROM nodes s
 WHERE s.wc_id = ?1 AND s.local_relpath = ?2 AND s.op_depth = ?3
 UNION ALL
 SELECT s.local_relpath, s.kind,
-  RELPATH_SKIP_JOIN(?2, ?4, s.local_relpath) drp, d.presence,
-  EXISTS(SELECT * FROM nodes sh
-         WHERE sh.wc_id = ?1 AND sh.op_depth > ?5
-           AND sh.local_relpath = d.local_relpath) shadowed
+  RELPATH_SKIP_JOIN(?2, ?4, s.local_relpath) drp, d.presence
 FROM nodes s
 LEFT OUTER JOIN nodes d ON d.wc_id= ?1 AND d.op_depth = ?5
      AND d.local_relpath = drp
@@ -295,17 +292,16 @@ INSERT OR REPLACE INTO nodes (
     changed_author, checksum, properties, translated_size, last_mod_time,
     symlink_target, moved_here, moved_to )
 SELECT
-    wc_id, ?4 /*local_relpath */, ?5 /*op_depth*/, ?6 /* parent_relpath */,
-    repos_id,
-    repos_path, revision, presence, depth, kind, changed_revision,
-    changed_date, changed_author, checksum, properties, translated_size,
-    last_mod_time, symlink_target, 1,
-    (SELECT dst.moved_to FROM nodes AS dst
-                         WHERE dst.wc_id = ?1
-                         AND dst.local_relpath = ?4
-                         AND dst.op_depth = ?5)
-FROM nodes
-WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3
+    s.wc_id, ?4 /*local_relpath */, ?5 /*op_depth*/, ?6 /* parent_relpath */,
+    s.repos_id,
+    s.repos_path, s.revision, s.presence, s.depth, s.kind, s.changed_revision,
+    s.changed_date, s.changed_author, s.checksum, s.properties,
+    CASE WHEN d.checksum=s.checksum THEN d.translated_size END,
+    CASE WHEN d.checksum=s.checksum THEN d.last_mod_time END,
+    s.symlink_target, 1, d.moved_to
+FROM nodes s
+LEFT JOIN nodes d ON d.wc_id=?1 AND d.local_relpath=?4 AND d.op_depth=?5
+WHERE s.wc_id = ?1 AND s.local_relpath = ?2 AND s.op_depth = ?3
 
 -- STMT_SELECT_NO_LONGER_MOVED_RV
 SELECT d.local_relpath, RELPATH_SKIP_JOIN(?2, ?4, d.local_relpath) srp,
@@ -327,7 +323,7 @@ ORDER BY d.local_relpath DESC
 
 -- STMT_SELECT_OP_DEPTH_CHILDREN
 SELECT local_relpath, kind FROM nodes
-WHERE wc_id = ?1 
+WHERE wc_id = ?1
   AND parent_relpath = ?2
   AND op_depth = ?3
   AND presence != MAP_BASE_DELETED
@@ -336,7 +332,7 @@ ORDER BY local_relpath
 
 -- STMT_SELECT_OP_DEPTH_CHILDREN_EXISTS
 SELECT local_relpath, kind FROM nodes
-WHERE wc_id = ?1 
+WHERE wc_id = ?1
   AND parent_relpath = ?2
   AND op_depth = ?3
   AND presence IN (MAP_NORMAL, MAP_INCOMPLETE)
@@ -470,7 +466,7 @@ SELECT (SELECT b.presence FROM nodes AS
          WHERE b.wc_id = ?1 AND b.local_relpath = ?2 AND b.op_depth = 0),
        work.presence, work.op_depth, moved.moved_to
 FROM nodes_current AS work
-LEFT OUTER JOIN nodes AS moved 
+LEFT OUTER JOIN nodes AS moved
   ON moved.wc_id = work.wc_id
  AND moved.local_relpath = work.local_relpath
  AND moved.moved_to IS NOT NULL
@@ -547,7 +543,7 @@ UPDATE nodes SET repos_id = ?4, dav_cach
 WHERE (wc_id = ?1 AND local_relpath = ?2 AND repos_id = ?3)
    OR (wc_id = ?1 AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
        AND repos_id = ?3)
- 
+
 
 -- STMT_UPDATE_LOCK_REPOS_ID
 UPDATE lock SET repos_id = ?2
@@ -804,7 +800,7 @@ WHERE wc_id = ?1
        OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND (changelist IS NULL
        OR NOT EXISTS (SELECT 1 FROM nodes_current c
-                      WHERE c.wc_id = ?1 
+                      WHERE c.wc_id = ?1
                         AND c.local_relpath = actual_node.local_relpath
                         AND c.kind = MAP_FILE))
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/wc.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/wc.h?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/wc.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/wc.h Mon Feb 16 
17:40:07 2015
@@ -158,7 +158,7 @@ extern "C" {
  * Bumped in r1395109.
  *
  * == 1.8.x shipped with format 31
- * 
+ *
  * Please document any further format changes here.
  */
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db.c?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db.c Mon Feb 16 
17:40:07 2015
@@ -611,8 +611,7 @@ blank_ibb(insert_base_baton_t *pibb)
    was recorded, otherwise to FALSE.
  */
 static svn_error_t *
-db_extend_parent_delete(svn_boolean_t *added_delete,
-                        svn_wc__db_wcroot_t *wcroot,
+db_extend_parent_delete(svn_wc__db_wcroot_t *wcroot,
                         const char *local_relpath,
                         svn_node_kind_t kind,
                         int op_depth,
@@ -625,9 +624,6 @@ db_extend_parent_delete(svn_boolean_t *a
 
   SVN_ERR_ASSERT(local_relpath[0]);
 
-  if (added_delete)
-    *added_delete = FALSE;
-
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_SELECT_LOWEST_WORKING_NODE));
   SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, parent_relpath,
@@ -654,9 +650,6 @@ db_extend_parent_delete(svn_boolean_t *a
                                     local_relpath, parent_op_depth,
                                     parent_relpath, kind_map, kind));
           SVN_ERR(svn_sqlite__update(NULL, stmt));
-
-          if (added_delete)
-            *added_delete = TRUE;
         }
     }
 
@@ -881,8 +874,7 @@ insert_base_node(const insert_base_baton
               || (pibb->status == svn_wc__db_status_incomplete))
           && ! pibb->file_external)
         {
-          SVN_ERR(db_extend_parent_delete(NULL,
-                                          wcroot, local_relpath,
+          SVN_ERR(db_extend_parent_delete(wcroot, local_relpath,
                                           pibb->kind, 0,
                                           scratch_pool));
         }
@@ -4878,15 +4870,12 @@ svn_wc__db_op_copy_layer_internal(svn_wc
     {
       const char *src_relpath;
       const char *dst_relpath;
-      svn_boolean_t exists;
 
       svn_pool_clear(iterpool);
 
       src_relpath = svn_sqlite__column_text(stmt, 0, iterpool);
       dst_relpath = svn_sqlite__column_text(stmt, 2, iterpool);
 
-      exists = !svn_sqlite__column_is_null(stmt, 3);
-
       err = svn_sqlite__bindf(stmt2, "isdsds", wcroot->wc_id,
                               src_relpath, src_op_depth,
                               dst_relpath, dst_op_depth,
@@ -4899,21 +4888,11 @@ svn_wc__db_op_copy_layer_internal(svn_wc
       if (err)
         break;
 
-      if (strlen(dst_relpath) > strlen(dst_op_relpath))
+      /* The node can't be deleted where it is added, so extension of
+         an existing shadowing is only interesting 2 levels deep. */
+      if (relpath_depth(dst_relpath) > (dst_op_depth+1))
         {
-          svn_boolean_t added_delete = FALSE;
-          svn_node_kind_t kind = svn_sqlite__column_token(stmt, 1, kind_map);
-
-          /* The op root can't be shadowed, so extension of a parent delete
-             is only needed when the parent can be deleted */
-          if (relpath_depth(dst_relpath) > (dst_op_depth+1))
-            {
-              err = db_extend_parent_delete(&added_delete, wcroot, dst_relpath,
-                                            kind, dst_op_depth, iterpool);
-
-              if (err)
-                break;
-            }
+          svn_boolean_t exists = !svn_sqlite__column_is_null(stmt, 3);
 
           if (exists)
             {
@@ -4921,28 +4900,19 @@ svn_wc__db_op_copy_layer_internal(svn_wc
 
               presence = svn_sqlite__column_token(stmt, 3, presence_map);
 
-              if (presence == svn_wc__db_status_not_present)
+              if (presence != svn_wc__db_status_normal)
                 exists = FALSE;
             }
 
-          /* ### Fails in a few tests... Needs further research */
-          /*SVN_ERR_ASSERT(!(exists && added_delete));*/
-
           if (!exists)
             {
-              svn_boolean_t shadowed;
+              svn_node_kind_t kind = svn_sqlite__column_token(stmt, 1, 
kind_map);
 
-              shadowed = svn_sqlite__column_int(stmt, 4);
+              err = db_extend_parent_delete(wcroot, dst_relpath,
+                                            kind, dst_op_depth, iterpool);
 
-              /*if (!shadowed && !added_delete)
-                {
-                  err = svn_error_createf(
-                              SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
-                              _("Node '%s' was unexpectedly added unshadowed"),
-                                path_for_error_message(wcroot, dst_relpath,
-                                                       iterpool));
-                  break;
-                }*/
+              if (err)
+                break;
             }
         }
 
@@ -5010,7 +4980,7 @@ svn_wc__db_op_copy_layer_internal(svn_wc
   SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt)));
 
   /* ### TODO: Did we handle ACTUAL as intended? */
-  
+
   SVN_ERR(add_work_items(wcroot->sdb, work_items, scratch_pool));
 
   if (conflict)
@@ -6796,7 +6766,7 @@ op_revert_txn(void *baton,
     }
   else
     {
-      SVN_ERR(svn_wc__db_read_conflict_internal(&conflict, wcroot,
+      SVN_ERR(svn_wc__db_read_conflict_internal(&conflict, NULL, wcroot,
                                                 local_relpath,
                                                 scratch_pool, scratch_pool));
     }
@@ -7024,7 +6994,7 @@ op_revert_recursive_txn(void *baton,
                         STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE));
       SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
       SVN_ERR(svn_sqlite__step_done(stmt));
-      
+
       SVN_ERR(svn_sqlite__get_statement(
                         &stmt, wcroot->sdb,
                         STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE));
@@ -13889,6 +13859,7 @@ svn_wc__db_get_conflict_marker_files(apr
 
 svn_error_t *
 svn_wc__db_read_conflict(svn_skel_t **conflict,
+                         svn_node_kind_t *kind,
                          svn_wc__db_t *db,
                          const char *local_abspath,
                          apr_pool_t *result_pool,
@@ -13902,14 +13873,15 @@ svn_wc__db_read_conflict(svn_skel_t **co
                               local_abspath, scratch_pool, scratch_pool));
   VERIFY_USABLE_WCROOT(wcroot);
 
-  return svn_error_trace(svn_wc__db_read_conflict_internal(conflict, wcroot,
-                                                           local_relpath,
+  return svn_error_trace(svn_wc__db_read_conflict_internal(conflict, kind,
+                                                           wcroot, 
local_relpath,
                                                            result_pool,
                                                            scratch_pool));
 }
 
 svn_error_t *
 svn_wc__db_read_conflict_internal(svn_skel_t **conflict,
+                                  svn_node_kind_t *kind,
                                   svn_wc__db_wcroot_t *wcroot,
                                   const char *local_relpath,
                                   apr_pool_t *result_pool,
@@ -13918,6 +13890,9 @@ svn_wc__db_read_conflict_internal(svn_sk
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
 
+  if (kind)
+    *kind = svn_node_none;
+
   /* Check if we have a conflict in ACTUAL */
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_SELECT_ACTUAL_NODE));
@@ -13925,12 +13900,13 @@ svn_wc__db_read_conflict_internal(svn_sk
 
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
 
-  if (! have_row)
+  if (!have_row || kind)
     {
       /* Do this while stmt is still open to avoid closing the sqlite
          transaction and then reopening. */
       svn_sqlite__stmt_t *stmt_node;
       svn_error_t *err;
+      svn_boolean_t have_info = FALSE;
 
       err = svn_sqlite__get_statement(&stmt_node, wcroot->sdb,
                                       STMT_SELECT_NODE_INFO);
@@ -13942,25 +13918,47 @@ svn_wc__db_read_conflict_internal(svn_sk
                                 local_relpath);
 
       if (!err)
-        err = svn_sqlite__step(&have_row, stmt_node);
+        err = svn_sqlite__step(&have_info, stmt_node);
+
+      if (!err && kind && have_info)
+        {
+          svn_wc__db_status_t status;
+          int op_depth = svn_sqlite__column_int(stmt_node, 0);
+
+          status = svn_sqlite__column_token(stmt_node, 3, presence_map);
+
+          if (op_depth > 0)
+            err = convert_to_working_status(&status, status);
+
+          if (!err && (status == svn_wc__db_status_normal
+                       || status == svn_wc__db_status_added
+                       || status == svn_wc__db_status_deleted
+                       || status == svn_wc__db_status_incomplete))
+            {
+              *kind = svn_sqlite__column_token(stmt_node, 4, kind_map);
+            }
+        }
 
       if (stmt_node)
         err = svn_error_compose_create(err,
                                        svn_sqlite__reset(stmt_node));
 
-      SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt)));
-
-      if (have_row)
+      if (!have_row || err)
         {
-          *conflict = NULL;
-          return SVN_NO_ERROR;
-        }
+          SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt)));
 
-      return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
-                               _("The node '%s' was not found."),
+          if (have_info)
+            {
+              *conflict = NULL;
+              return SVN_NO_ERROR;
+            }
+
+          return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+                                   _("The node '%s' was not found."),
                                    path_for_error_message(wcroot,
                                                           local_relpath,
                                                           scratch_pool));
+        }
     }
 
   {
@@ -16280,7 +16278,7 @@ static int
 compare_queue_items(const void *v1,
                     const void *v2)
 {
-  const commit_queue_item_t *cqi1 
+  const commit_queue_item_t *cqi1
               = *(const commit_queue_item_t **)v1;
   const commit_queue_item_t *cqi2
               = *(const commit_queue_item_t **)v2;

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db.h?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db.h Mon Feb 16 
17:40:07 2015
@@ -2350,7 +2350,8 @@ svn_wc__db_get_conflict_marker_files(apr
                                      apr_pool_t *scratch_pool);
 
 /* Read the conflict information recorded on LOCAL_ABSPATH in *CONFLICT,
-   an editable conflict skel.
+   an editable conflict skel. If kind is not NULL, also read the node kind
+   in *KIND. (SHOW_HIDDEN: false, SHOW_DELETED: true)
 
    If the node exists, but does not have a conflict set *CONFLICT to NULL,
    otherwise return a SVN_ERR_WC_PATH_NOT_FOUND error.
@@ -2359,6 +2360,7 @@ svn_wc__db_get_conflict_marker_files(apr
    SCRATCH_POOL */
 svn_error_t *
 svn_wc__db_read_conflict(svn_skel_t **conflict,
+                         svn_node_kind_t *kind,
                          svn_wc__db_t *db,
                          const char *local_abspath,
                          apr_pool_t *result_pool,
@@ -3485,7 +3487,7 @@ svn_wc__db_resolve_delete_raise_moved_aw
 
 /* Like svn_wc__db_resolve_delete_raise_moved_away this should be
    combined.
-   
+
    ### LOCAL_ABSPATH specifies the move origin, but the move origin
    ### is not necessary unique enough. This function needs an op_root_abspath
    ### argument to differentiate between different origins.

Modified: 
subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db_private.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db_private.h?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db_private.h 
(original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db_private.h 
Mon Feb 16 17:40:07 2015
@@ -328,6 +328,7 @@ svn_wc__db_fetch_repos_info(const char *
    DB+LOCAL_ABSPATH, and outputting relpaths instead of abspaths. */
 svn_error_t *
 svn_wc__db_read_conflict_internal(svn_skel_t **conflict,
+                                  svn_node_kind_t *kind,
                                   svn_wc__db_wcroot_t *wcroot,
                                   const char *local_relpath,
                                   apr_pool_t *result_pool,

Modified: 
subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db_update_move.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db_update_move.c?rev=1660173&r1=1660172&r2=1660173&view=diff
==============================================================================
--- 
subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db_update_move.c 
(original)
+++ 
subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db_update_move.c 
Mon Feb 16 17:40:07 2015
@@ -228,6 +228,7 @@ typedef struct node_move_baton_t
 static svn_error_t *
 update_move_list_add(svn_wc__db_wcroot_t *wcroot,
                      const char *local_relpath,
+                     svn_wc__db_t *db,
                      svn_wc_notify_action_t action,
                      svn_node_kind_t kind,
                      svn_wc_notify_state_t content_state,
@@ -240,9 +241,18 @@ update_move_list_add(svn_wc__db_wcroot_t
 
   if (conflict)
     {
-      action = svn_wc_notify_tree_conflict;
-      content_state = svn_wc_notify_state_inapplicable;
-      prop_state = svn_wc_notify_state_inapplicable;
+      svn_boolean_t tree_conflict;
+
+      SVN_ERR(svn_wc__conflict_read_info(NULL, NULL, NULL, NULL,
+                                         &tree_conflict,
+                                         db, wcroot->abspath, conflict,
+                                         scratch_pool, scratch_pool));
+      if (tree_conflict)
+        {
+          action = svn_wc_notify_tree_conflict;
+          content_state = svn_wc_notify_state_inapplicable;
+          prop_state = svn_wc_notify_state_inapplicable;
+        }
     }
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -367,7 +377,8 @@ create_tree_conflict(svn_skel_t **confli
                                            child_relpath, scratch_pool);
     }
 
-  err = svn_wc__db_read_conflict_internal(&conflict, wcroot, local_relpath,
+  err = svn_wc__db_read_conflict_internal(&conflict, NULL,
+                                          wcroot, local_relpath,
                                           result_pool, scratch_pool);
   if (err && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
     return svn_error_trace(err);
@@ -437,16 +448,10 @@ create_tree_conflict(svn_skel_t **confli
                      result_pool,
                      scratch_pool));
 
-  if (reason != svn_wc_conflict_reason_unversioned
-      && old_repos_relpath != NULL /* no local additions */)
-    {
-      conflict_old_version = svn_wc_conflict_version_create2(
+  conflict_old_version = svn_wc_conflict_version_create2(
                                old_version->repos_url, old_version->repos_uuid,
                                old_repos_relpath, old_version->peg_rev,
                                old_kind, scratch_pool);
-    }
-  else
-    conflict_old_version = NULL;
 
   conflict_new_version = svn_wc_conflict_version_create2(
                            new_version->repos_url, new_version->repos_uuid,
@@ -477,7 +482,6 @@ create_node_tree_conflict(svn_skel_t **c
                           const char *dst_local_relpath,
                           svn_node_kind_t old_kind,
                           svn_node_kind_t new_kind,
-                          const char *old_repos_relpath,
                           svn_wc_conflict_reason_t reason,
                           svn_wc_conflict_action_t action,
                           const char *move_src_op_root_relpath,
@@ -485,6 +489,18 @@ create_node_tree_conflict(svn_skel_t **c
                           apr_pool_t *scratch_pool)
 {
   update_move_baton_t *umb = nmb->umb;
+  const char *dst_repos_relpath;
+  const char *dst_root_relpath = svn_relpath_limit(nmb->dst_relpath,
+                                                   nmb->umb->dst_op_depth,
+                                                   scratch_pool);
+
+  dst_repos_relpath =
+            svn_relpath_join(nmb->umb->old_version->path_in_repos,
+                             svn_relpath_skip_ancestor(dst_root_relpath,
+                                                       nmb->dst_relpath),
+                             scratch_pool);
+
+
 
   return svn_error_trace(
             create_tree_conflict(conflict_p, umb->wcroot, dst_local_relpath,
@@ -494,7 +510,7 @@ create_node_tree_conflict(svn_skel_t **c
                                  umb->db,
                                  umb->old_version, umb->new_version,
                                  umb->operation, old_kind, new_kind,
-                                 old_repos_relpath,
+                                 dst_repos_relpath,
                                  reason, action, move_src_op_root_relpath,
                                  result_pool, scratch_pool));
 }
@@ -537,7 +553,6 @@ static svn_error_t *
 mark_tc_on_op_root(node_move_baton_t *nmb,
                    svn_node_kind_t old_kind,
                    svn_node_kind_t new_kind,
-                   const char *old_repos_relpath,
                    svn_wc_conflict_action_t action,
                    apr_pool_t *scratch_pool)
 {
@@ -559,7 +574,6 @@ mark_tc_on_op_root(node_move_baton_t *nm
 
   SVN_ERR(create_node_tree_conflict(&conflict, nmb, nmb->dst_relpath,
                                     old_kind, new_kind,
-                                    old_repos_relpath,
                                     (move_dst_relpath
                                      ? svn_wc_conflict_reason_moved_away
                                      : svn_wc_conflict_reason_deleted),
@@ -568,7 +582,7 @@ mark_tc_on_op_root(node_move_baton_t *nm
                                               : NULL,
                                     scratch_pool, scratch_pool));
 
-  SVN_ERR(update_move_list_add(b->wcroot, nmb->dst_relpath,
+  SVN_ERR(update_move_list_add(b->wcroot, nmb->dst_relpath, b->db,
                                svn_wc_notify_tree_conflict,
                                new_kind,
                                svn_wc_notify_state_inapplicable,
@@ -601,10 +615,9 @@ mark_node_edited(node_move_baton_t *nmb,
   if (nmb->shadowed && !(nmb->pb && nmb->pb->shadowed))
     {
       svn_node_kind_t dst_kind, src_kind;
-      const char *dst_repos_relpath;
 
       SVN_ERR(svn_wc__db_depth_get_info(NULL, &dst_kind, NULL,
-                                        &dst_repos_relpath, NULL, NULL, NULL,
+                                        NULL, NULL, NULL, NULL,
                                         NULL, NULL, NULL, NULL, NULL, NULL,
                                         nmb->umb->wcroot, nmb->dst_relpath,
                                         nmb->umb->dst_op_depth,
@@ -619,7 +632,6 @@ mark_node_edited(node_move_baton_t *nmb,
 
       SVN_ERR(mark_tc_on_op_root(nmb,
                                  dst_kind, src_kind,
-                                 dst_repos_relpath,
                                  svn_wc_conflict_action_edit,
                                  scratch_pool));
     }
@@ -649,61 +661,61 @@ tc_editor_add_directory(node_move_baton_
                         apr_pool_t *scratch_pool)
 {
   update_move_baton_t *b = nmb->umb;
-  const char *move_dst_repos_relpath;
   const char *local_abspath;
   svn_node_kind_t wc_kind;
   svn_skel_t *work_item = NULL;
   svn_skel_t *conflict = NULL;
+  svn_wc_conflict_reason_t reason = svn_wc_conflict_reason_unversioned;
 
   SVN_ERR(mark_parent_edited(nmb, scratch_pool));
   if (nmb->skip)
     return SVN_NO_ERROR;
 
-  /* We can't read the information from the pre-add node to obtain the
-     relpath, but in WORKING we can just calculate it from the op-root */
-  {
-    const char *dst_op_root_relpath = svn_relpath_limit(nmb->pb->dst_relpath,
-                                                        b->dst_op_depth,
-                                                        scratch_pool);
-    SVN_ERR(svn_wc__db_depth_get_info(NULL, NULL, NULL,
-                                      &move_dst_repos_relpath, NULL, NULL,
-                                      NULL, NULL, NULL, NULL, NULL, NULL,
-                                      NULL,
-                                      b->wcroot, dst_op_root_relpath,
-                                      b->dst_op_depth,
-                                      scratch_pool, scratch_pool));
-
-    move_dst_repos_relpath =
-            svn_relpath_join(move_dst_repos_relpath,
-                             svn_relpath_skip_ancestor(dst_op_root_relpath,
-                                                       relpath),
-                             scratch_pool);
-  }
-
   if (nmb->shadowed)
     {
-      SVN_ERR(mark_tc_on_op_root(nmb,
-                                 svn_node_none, svn_node_dir,
-                                 move_dst_repos_relpath,
-                                 svn_wc_conflict_action_add,
-                                 scratch_pool));
-      return SVN_NO_ERROR;
+      svn_wc__db_status_t status;
+
+      SVN_ERR(svn_wc__db_read_info_internal(&status, &wc_kind, NULL, NULL,
+                                            NULL, NULL, NULL, NULL, NULL, NULL,
+                                            NULL, NULL, NULL, NULL, NULL, NULL,
+                                            NULL, NULL, NULL, NULL, NULL, NULL,
+                                            NULL, NULL, NULL,
+                                            b->wcroot, relpath,
+                                            scratch_pool, scratch_pool));
+
+      if (status == svn_wc__db_status_deleted)
+        reason = svn_wc_conflict_reason_deleted;
+      else if (status != svn_wc__db_status_added)
+        wc_kind = svn_node_none;
+      else if (old_kind == svn_node_none)
+        reason = svn_wc_conflict_reason_added;
+      else
+        reason = svn_wc_conflict_reason_replaced;
     }
+  else
+    wc_kind = svn_node_none;
 
-  /* Check for unversioned tree-conflict */
   local_abspath = svn_dirent_join(b->wcroot->abspath, relpath, scratch_pool);
 
-  SVN_ERR(svn_io_check_path(local_abspath, &wc_kind, scratch_pool));
-  if (wc_kind == old_kind)
+  if (wc_kind == svn_node_none)
+    {
+      /* Check for unversioned tree-conflict */
+      SVN_ERR(svn_io_check_path(local_abspath, &wc_kind, scratch_pool));
+    }
+
+  if (!nmb->shadowed && wc_kind == old_kind)
     wc_kind = svn_node_none; /* Node will be gone once we install */
 
-  if (wc_kind != svn_node_none)
+  if (wc_kind != svn_node_none
+      && (nmb->shadowed || wc_kind != old_kind)) /* replace */
     {
       SVN_ERR(create_node_tree_conflict(&conflict, nmb, relpath,
-                                        wc_kind, svn_node_dir,
-                                        move_dst_repos_relpath,
-                                        svn_wc_conflict_reason_unversioned,
-                                        svn_wc_conflict_action_add, NULL,
+                                        old_kind, svn_node_dir,
+                                        reason,
+                                        (old_kind == svn_node_none)
+                                          ? svn_wc_conflict_action_add
+                                          : svn_wc_conflict_action_replace,
+                                        NULL,
                                         scratch_pool, scratch_pool));
       nmb->skip = TRUE;
     }
@@ -713,7 +725,7 @@ tc_editor_add_directory(node_move_baton_
                                            scratch_pool, scratch_pool));
     }
 
-  SVN_ERR(update_move_list_add(b->wcroot, relpath,
+  SVN_ERR(update_move_list_add(b->wcroot, relpath, b->db,
                                (old_kind == svn_node_none)
                                   ? svn_wc_notify_update_add
                                   : svn_wc_notify_update_replace,
@@ -733,7 +745,7 @@ tc_editor_add_file(node_move_baton_t *nm
                    apr_pool_t *scratch_pool)
 {
   update_move_baton_t *b = nmb->umb;
-  const char *move_dst_repos_relpath;
+  svn_wc_conflict_reason_t reason = svn_wc_conflict_reason_unversioned;
   svn_node_kind_t wc_kind;
   const char *local_abspath;
   svn_skel_t *work_item = NULL;
@@ -743,52 +755,48 @@ tc_editor_add_file(node_move_baton_t *nm
   if (nmb->skip)
     return SVN_NO_ERROR;
 
-  /* We can't read the information from the pre-add node to obtain the
-     relpath, but in WORKING we can just calculate it from the op-root */
-  {
-    const char *dst_op_root_relpath = svn_relpath_limit(nmb->pb->dst_relpath,
-                                                        b->dst_op_depth,
-                                                        scratch_pool);
-    SVN_ERR(svn_wc__db_depth_get_info(NULL, NULL, NULL,
-                                      &move_dst_repos_relpath, NULL, NULL,
-                                      NULL, NULL, NULL, NULL, NULL, NULL,
-                                      NULL,
-                                      b->wcroot, dst_op_root_relpath,
-                                      b->dst_op_depth,
-                                      scratch_pool, scratch_pool));
-
-    move_dst_repos_relpath =
-            svn_relpath_join(move_dst_repos_relpath,
-                             svn_relpath_skip_ancestor(dst_op_root_relpath,
-                                                       relpath),
-                             scratch_pool);
-  }
-
-  /* Check for NODES tree-conflict. */
   if (nmb->shadowed)
     {
-      SVN_ERR(mark_tc_on_op_root(nmb,
-                                 svn_node_none, svn_node_file,
-                                 move_dst_repos_relpath,
-                                 svn_wc_conflict_action_add,
-                                 scratch_pool));
-      return SVN_NO_ERROR;
+      svn_wc__db_status_t status;
+
+      SVN_ERR(svn_wc__db_read_info_internal(&status, &wc_kind, NULL, NULL,
+                                            NULL, NULL, NULL, NULL, NULL, NULL,
+                                            NULL, NULL, NULL, NULL, NULL, NULL,
+                                            NULL, NULL, NULL, NULL, NULL, NULL,
+                                            NULL, NULL, NULL,
+                                            b->wcroot, relpath,
+                                            scratch_pool, scratch_pool));
+
+      if (status == svn_wc__db_status_deleted)
+        reason = svn_wc_conflict_reason_deleted;
+      else if (status != svn_wc__db_status_added)
+        wc_kind = svn_node_none;
+      else if (old_kind == svn_node_none)
+        reason = svn_wc_conflict_reason_added;
+      else
+        reason = svn_wc_conflict_reason_replaced;
     }
+  else
+    wc_kind = svn_node_none;
 
-  /* Check for unversioned tree-conflict */
   local_abspath = svn_dirent_join(b->wcroot->abspath, relpath, scratch_pool);
-  SVN_ERR(svn_io_check_path(local_abspath, &wc_kind, scratch_pool));
 
-  if (wc_kind == old_kind)
-    wc_kind = svn_node_none; /* Node will be gone once we install */
+  if (wc_kind == svn_node_none)
+    {
+      /* Check for unversioned tree-conflict */
+      SVN_ERR(svn_io_check_path(local_abspath, &wc_kind, scratch_pool));
+    }
 
-  if (wc_kind != svn_node_none)
+  if (wc_kind != svn_node_none
+      && (nmb->shadowed || wc_kind != old_kind)) /* replace */
     {
       SVN_ERR(create_node_tree_conflict(&conflict, nmb, relpath,
-                                        wc_kind, svn_node_file,
-                                        move_dst_repos_relpath,
-                                        svn_wc_conflict_reason_unversioned,
-                                        svn_wc_conflict_action_add, NULL,
+                                        old_kind, svn_node_file,
+                                        reason,
+                                        (old_kind == svn_node_none)
+                                          ? svn_wc_conflict_action_add
+                                          : svn_wc_conflict_action_replace,
+                                        NULL,
                                         scratch_pool, scratch_pool));
       nmb->skip = TRUE;
     }
@@ -805,7 +813,7 @@ tc_editor_add_file(node_move_baton_t *nm
                                             scratch_pool, scratch_pool));
     }
 
-  SVN_ERR(update_move_list_add(b->wcroot, relpath,
+  SVN_ERR(update_move_list_add(b->wcroot, relpath, b->db,
                                (old_kind == svn_node_none)
                                   ? svn_wc_notify_update_add
                                   : svn_wc_notify_update_replace,
@@ -967,8 +975,7 @@ tc_editor_alter_directory(node_move_bato
   if (wc_kind != svn_node_none && wc_kind != svn_node_dir)
     {
       SVN_ERR(create_node_tree_conflict(&conflict_skel, nmb, dst_relpath,
-                                        wc_kind, svn_node_dir,
-                                        NULL /* local obstruction relpath */,
+                                        svn_node_dir, svn_node_dir,
                                         svn_wc_conflict_reason_obstructed,
                                         svn_wc_conflict_action_edit,
                                         NULL,
@@ -1010,7 +1017,7 @@ tc_editor_alter_directory(node_move_bato
                                       scratch_pool, scratch_pool));
     }
 
-  SVN_ERR(update_move_list_add(b->wcroot, dst_relpath,
+  SVN_ERR(update_move_list_add(b->wcroot, dst_relpath, b->db,
                                svn_wc_notify_update_update,
                                svn_node_dir,
                                svn_wc_notify_state_inapplicable,
@@ -1070,8 +1077,7 @@ tc_editor_alter_file(node_move_baton_t *
   if (wc_kind != svn_node_none && wc_kind != svn_node_file)
     {
       SVN_ERR(create_node_tree_conflict(&conflict_skel, nmb, dst_relpath,
-                                        wc_kind, svn_node_file,
-                                        NULL /* local obstruction relpath */,
+                                        svn_node_file, svn_node_file,
                                         svn_wc_conflict_reason_obstructed,
                                         svn_wc_conflict_action_edit,
                                         NULL,
@@ -1180,7 +1186,7 @@ tc_editor_alter_file(node_move_baton_t *
       work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool);
     }
 
-  SVN_ERR(update_move_list_add(b->wcroot, dst_relpath,
+  SVN_ERR(update_move_list_add(b->wcroot, dst_relpath, b->db,
                                svn_wc_notify_update_update,
                                svn_node_file,
                                content_state,
@@ -1199,8 +1205,6 @@ tc_editor_delete(node_move_baton_t *nmb,
 {
   update_move_baton_t *b = nmb->umb;
   svn_sqlite__stmt_t *stmt;
-  const char *move_dst_repos_relpath;
-  svn_node_kind_t move_dst_kind;
   const char *local_abspath;
   svn_boolean_t is_modified, is_all_deletes;
   svn_skel_t *work_items = NULL;
@@ -1210,21 +1214,13 @@ tc_editor_delete(node_move_baton_t *nmb,
   if (nmb->skip)
     return SVN_NO_ERROR;
 
-  SVN_ERR(svn_wc__db_depth_get_info(NULL, &move_dst_kind, NULL,
-                                    &move_dst_repos_relpath, NULL, NULL, NULL,
-                                    NULL, NULL, NULL, NULL, NULL, NULL,
-                                    b->wcroot, relpath, b->dst_op_depth,
-                                    scratch_pool, scratch_pool));
-
   /* Check before retracting delete to catch delete-delete
      conflicts. This catches conflicts on the node itself; deleted
      children are caught as local modifications below.*/
   if (nmb->shadowed)
     {
       SVN_ERR(mark_tc_on_op_root(nmb,
-                                 move_dst_kind,
-                                 new_kind,
-                                 move_dst_repos_relpath,
+                                 old_kind, new_kind,
                                  svn_wc_conflict_action_delete,
                                  scratch_pool));
       return SVN_NO_ERROR;
@@ -1252,8 +1248,7 @@ tc_editor_delete(node_move_baton_t *nmb,
       reason = svn_wc_conflict_reason_edited;
 
       SVN_ERR(create_node_tree_conflict(&conflict, nmb, relpath,
-                                        move_dst_kind, new_kind,
-                                        move_dst_repos_relpath, reason,
+                                        old_kind, new_kind, reason,
                                         (new_kind == svn_node_none)
                                           ? svn_wc_conflict_action_delete
                                           : svn_wc_conflict_action_replace,
@@ -1319,9 +1314,9 @@ tc_editor_delete(node_move_baton_t *nmb,
 
   /* Only notify if add_file/add_dir is not going to notify */
   if (conflict || (new_kind == svn_node_none))
-    SVN_ERR(update_move_list_add(b->wcroot, relpath,
+    SVN_ERR(update_move_list_add(b->wcroot, relpath, b->db,
                                  svn_wc_notify_update_delete,
-                                 move_dst_kind,
+                                 new_kind,
                                  svn_wc_notify_state_inapplicable,
                                  svn_wc_notify_state_inapplicable,
                                  conflict, work_items, scratch_pool));
@@ -1370,8 +1365,8 @@ get_tc_info(svn_wc_operation_t *operatio
   svn_skel_t *conflict_skel;
 
   /* Check for tree conflict on src. */
-  SVN_ERR(svn_wc__db_read_conflict(&conflict_skel, db,
-                                   src_abspath,
+  SVN_ERR(svn_wc__db_read_conflict(&conflict_skel, NULL,
+                                   db, src_abspath,
                                    scratch_pool, scratch_pool));
   if (!conflict_skel)
     return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
@@ -1947,6 +1942,7 @@ depth_sufficient_to_bump(svn_boolean_t *
 static svn_error_t *
 bump_mark_tree_conflict(svn_wc__db_wcroot_t *wcroot,
                         const char *move_src_root_relpath,
+                        int src_op_depth,
                         const char *move_src_op_root_relpath,
                         const char *move_dst_op_root_relpath,
                         svn_wc__db_t *db,
@@ -1969,12 +1965,12 @@ bump_mark_tree_conflict(svn_wc__db_wcroo
   SVN_ERR(verify_write_lock(wcroot, move_src_root_relpath, scratch_pool));
 
   /* Read new (post-update) information from the new move source BASE node. */
-  SVN_ERR(svn_wc__db_base_get_info_internal(NULL, &new_kind, &new_rev,
-                                            &new_repos_relpath, &repos_id,
-                                            NULL, NULL, NULL, NULL, NULL,
-                                            NULL, NULL, NULL, NULL, NULL,
-                                            wcroot, move_src_op_root_relpath,
-                                            scratch_pool, scratch_pool));
+  SVN_ERR(svn_wc__db_depth_get_info(NULL, &new_kind, &new_rev,
+                                    &new_repos_relpath, &repos_id,
+                                    NULL, NULL, NULL, NULL, NULL,
+                                    NULL, NULL, NULL,
+                                    wcroot, move_src_op_root_relpath,
+                                    src_op_depth, scratch_pool, scratch_pool));
   SVN_ERR(svn_wc__db_fetch_repos_info(&repos_root_url, &repos_uuid,
                                       wcroot, repos_id, scratch_pool));
 
@@ -2026,7 +2022,7 @@ bump_mark_tree_conflict(svn_wc__db_wcroo
                                move_src_op_root_relpath,
                                scratch_pool, scratch_pool));
 
-  SVN_ERR(update_move_list_add(wcroot, move_src_root_relpath,
+  SVN_ERR(update_move_list_add(wcroot, move_src_root_relpath, db,
                                svn_wc_notify_tree_conflict,
                                new_kind,
                                svn_wc_notify_state_inapplicable,
@@ -2110,6 +2106,7 @@ bump_moved_layer(svn_boolean_t *recurse,
   svn_boolean_t have_row;
   svn_skel_t *conflict;
   svn_boolean_t can_bump;
+  const char *src_root_relpath;
 
   SVN_ERR(verify_write_lock(wcroot, local_relpath, scratch_pool));
 
@@ -2148,24 +2145,21 @@ bump_moved_layer(svn_boolean_t *recurse,
         can_bump = FALSE;
     }
 
-  {
-    const char *src_root_relpath = src_relpath;
-    while (relpath_depth(src_root_relpath) > src_del_depth)
-      src_root_relpath = svn_relpath_dirname(src_root_relpath, scratch_pool);
-
-    if (!can_bump)
-      {
-        SVN_ERR(bump_mark_tree_conflict(wcroot, src_relpath,
-                                        src_root_relpath, dst_relpath,
-                                        db, scratch_pool));
+  src_root_relpath = svn_relpath_limit(src_relpath, src_del_depth,
+                                       scratch_pool);
 
-        return SVN_NO_ERROR;
-      }
+  if (!can_bump)
+    {
+      SVN_ERR(bump_mark_tree_conflict(wcroot, src_relpath, op_depth,
+                                      src_root_relpath, dst_relpath,
+                                      db, scratch_pool));
 
-    SVN_ERR(svn_wc__db_read_conflict_internal(&conflict, wcroot,
-                                              src_root_relpath,
-                                              scratch_pool, scratch_pool));
-  }
+      return SVN_NO_ERROR;
+    }
+
+  SVN_ERR(svn_wc__db_read_conflict_internal(&conflict, NULL, wcroot,
+                                            src_root_relpath,
+                                            scratch_pool, scratch_pool));
 
   /* ### TODO: check this is the right sort of tree-conflict? */
   if (!conflict)
@@ -2321,7 +2315,7 @@ svn_wc__db_bump_moved_away(svn_wc__db_wc
               if (locked)
                 {
                   SVN_ERR(bump_mark_tree_conflict(wcroot,
-                                                  move_src_root_relpath,
+                                                  move_src_root_relpath, 0,
                                                   delete_relpath,
                                                   move_dst_op_root_relpath,
                                                   db, scratch_pool));
@@ -2385,7 +2379,7 @@ svn_wc__db_op_raise_moved_away_internal(
                                  iterpool, iterpool);
 
       if (!err)
-        err = update_move_list_add(wcroot, src_relpath,
+        err = update_move_list_add(wcroot, src_relpath, db,
                                    svn_wc_notify_tree_conflict,
                                    src_kind,
                                    svn_wc_notify_state_inapplicable,
@@ -2481,6 +2475,7 @@ break_moved_away(svn_wc__db_wcroot_t *wc
 
 static svn_error_t *
 break_moved_away_children(svn_wc__db_wcroot_t *wcroot,
+                          svn_wc__db_t *db,
                           const char *local_relpath,
                           apr_pool_t *scratch_pool)
 {
@@ -2514,7 +2509,7 @@ break_moved_away_children(svn_wc__db_wcr
 
       if (! err)
         {
-          err = update_move_list_add(wcroot, src_relpath,
+          err = update_move_list_add(wcroot, src_relpath, db,
                                      svn_wc_notify_move_broken,
                                      src_kind,
                                      svn_wc_notify_state_inapplicable,
@@ -2599,7 +2594,7 @@ svn_wc__db_resolve_break_moved_away_chil
   VERIFY_USABLE_WCROOT(wcroot);
 
   SVN_WC__DB_WITH_TXN(
-    break_moved_away_children(wcroot, local_relpath, scratch_pool),
+    break_moved_away_children(wcroot, db, local_relpath, scratch_pool),
     wcroot);
 
   SVN_ERR(svn_wc__db_update_move_list_notify(wcroot,


Reply via email to