You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/01/08 15:35:08 UTC

svn commit: r1430302 - in /subversion/trunk/subversion: libsvn_wc/conflicts.c libsvn_wc/conflicts.h libsvn_wc/update_editor.c libsvn_wc/upgrade.c libsvn_wc/wc_db_update_move.c tests/libsvn_wc/conflict-data-test.c

Author: rhuijben
Date: Tue Jan  8 14:35:07 2013
New Revision: 1430302

URL: http://svn.apache.org/viewvc?rev=1430302&view=rev
Log:
Since file moves now start introducing 'update induced' conflicts on WORKING
nodes the assumption that the location can be read from BASE is no longer
valid. So start recording the full repository location in the conflict skel.

This avoid something the update_move handling calls the 'scan dance'.

* subversion/libsvn_wc/conflicts.c
  (svn_wc__conflict_skel_set_op_update,
   svn_wc__conflict_skel_set_op_switch): Store additional location.

  (setup_tree_conflict_desc): Assume the location is there, or a legacy (1.7)
    conflict.

* subversion/libsvn_wc/conflicts.h
  (svn_wc__conflict_skel_set_op_update,
   svn_wc__conflict_skel_set_op_switch): Add argument.

* subversion/libsvn_wc/update_editor.c
  (complete_conflict): Receive target location info.
  (delete_entry,
   add_directory,
   open_directory,
   close_directory,
   add_file,
   open_file): Update caller.

* subversion/libsvn_wc/upgrade.c
  (svn_wc__upgrade_conflict_skel_from_raw): Update caller.

* subversion/libsvn_wc/wc_db_update_move.c
  (check_tree_conflict,
   mark_unversioned_add_conflict,
   create_conflict_markers): Update caller.
  (get_tc_info): Remove the scan dance.

* subversion/tests/libsvn_wc/conflict-data-test.c
  (test_serialize_prop_conflict,
   test_serialize_tree_conflict): Update caller.

Modified:
    subversion/trunk/subversion/libsvn_wc/conflicts.c
    subversion/trunk/subversion/libsvn_wc/conflicts.h
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/libsvn_wc/upgrade.c
    subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c
    subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c

Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=1430302&r1=1430301&r2=1430302&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Tue Jan  8 14:35:07 2013
@@ -209,6 +209,7 @@ conflict__get_operation(svn_skel_t **why
 svn_error_t *
 svn_wc__conflict_skel_set_op_update(svn_skel_t *conflict_skel,
                                     const svn_wc_conflict_version_t *original,
+                                    const svn_wc_conflict_version_t *target,
                                     apr_pool_t *result_pool,
                                     apr_pool_t *scratch_pool)
 {
@@ -228,6 +229,8 @@ svn_wc__conflict_skel_set_op_update(svn_
 
   origins = svn_skel__make_empty_list(result_pool);
 
+  SVN_ERR(conflict__prepend_location(origins, target, TRUE,
+                                     result_pool, scratch_pool));
   SVN_ERR(conflict__prepend_location(origins, original, TRUE,
                                      result_pool, scratch_pool));
 
@@ -240,6 +243,7 @@ svn_wc__conflict_skel_set_op_update(svn_
 svn_error_t *
 svn_wc__conflict_skel_set_op_switch(svn_skel_t *conflict_skel,
                                     const svn_wc_conflict_version_t *original,
+                                    const svn_wc_conflict_version_t *target,
                                     apr_pool_t *result_pool,
                                     apr_pool_t *scratch_pool)
 {
@@ -259,6 +263,8 @@ svn_wc__conflict_skel_set_op_switch(svn_
 
   origins = svn_skel__make_empty_list(result_pool);
 
+  SVN_ERR(conflict__prepend_location(origins, target, TRUE,
+                                     result_pool, scratch_pool));
   SVN_ERR(conflict__prepend_location(origins, original, TRUE,
                                      result_pool, scratch_pool));
 
@@ -1780,69 +1786,12 @@ setup_tree_conflict_desc(svn_wc_conflict
                 ? APR_ARRAY_IDX(locations, 1, svn_wc_conflict_version_t *)
                 : NULL;
 
-  if (incoming_change != svn_wc_conflict_action_delete
-      && (operation == svn_wc_operation_update
-          || operation == svn_wc_operation_switch))
-    {
-      svn_wc__db_status_t status;
-      svn_revnum_t revision;
-      const char *repos_relpath;
-      const char *repos_root_url;
-      const char *repos_uuid;
-      svn_kind_t kind;
-      svn_error_t *err;
-
-      /* ### Theoretically we should just fetch the BASE information
-             here. This code might need tweaks until all tree conflicts
-             are installed in the proper state */
-
-      SVN_ERR_ASSERT(v2 == NULL); /* Not set for update and switch */
-
-      /* With an update or switch we have to fetch the second location
-         for a tree conflict from WORKING. (For text or prop from BASE)
-         
-         ### stsp: The code below doesn't seem to agree with this comment.
-         ###       Do we want to get info from BASE or WORKING?
-       */
-      err = svn_wc__db_base_get_info(&status, &kind, &revision,
-                                     &repos_relpath, &repos_root_url,
-                                     &repos_uuid, NULL, NULL, NULL,
-                                     NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                                     db, local_abspath,
-                                     scratch_pool, scratch_pool);
-
-      if (err)
-        {
-          if (err && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
-            return svn_error_trace(err);
-
-          svn_error_clear(err);
-          /* Ignore BASE */
-
-          tc_kind = svn_node_file; /* Avoid assertion */
-        }
-      else if (repos_relpath)
-        {
-          v2 = svn_wc_conflict_version_create2(repos_root_url,
-                                               repos_uuid,
-                                               repos_relpath,
-                                               revision,
-                                               svn__node_kind_from_kind(kind),
-                                               result_pool);
-          tc_kind = svn__node_kind_from_kind(kind);
-        }
-      else
-        tc_kind = svn_node_file; /* Avoid assertion */
-    }
+  if (v1)
+    tc_kind = v1->node_kind;
+  else if (v2)
+    tc_kind = v2->node_kind;
   else
-    {
-      if (v1)
-        tc_kind = v1->node_kind;
-      else if (v2)
-        tc_kind = v2->node_kind;
-      else
-        tc_kind = svn_node_file; /* Avoid assertion */
-    }
+    tc_kind = svn_node_file; /* Avoid assertion */
 
   *desc = svn_wc_conflict_description_create_tree2(local_abspath, tc_kind,
                                                    operation, v1, v2,

Modified: subversion/trunk/subversion/libsvn_wc/conflicts.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.h?rev=1430302&r1=1430301&r2=1430302&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.h (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.h Tue Jan  8 14:35:07 2013
@@ -87,6 +87,7 @@ svn_wc__conflict_skel_is_complete(svn_bo
 svn_error_t *
 svn_wc__conflict_skel_set_op_update(svn_skel_t *conflict_skel,
                                     const svn_wc_conflict_version_t *original,
+                                    const svn_wc_conflict_version_t *target,
                                     apr_pool_t *result_pool,
                                     apr_pool_t *scratch_pool);
 
@@ -103,6 +104,7 @@ svn_wc__conflict_skel_set_op_update(svn_
 svn_error_t *
 svn_wc__conflict_skel_set_op_switch(svn_skel_t *conflict_skel,
                                     const svn_wc_conflict_version_t *original,
+                                    const svn_wc_conflict_version_t *target,
                                     apr_pool_t *result_pool,
                                     apr_pool_t *scratch_pool);
 

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1430302&r1=1430301&r2=1430302&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Tue Jan  8 14:35:07 2013
@@ -853,11 +853,15 @@ complete_conflict(svn_skel_t *conflict,
                   const char *local_abspath,
                   const char *old_repos_relpath,
                   svn_revnum_t old_revision,
+                  const char *new_repos_relpath,
                   svn_node_kind_t local_kind,
-                  apr_pool_t *result_pool, apr_pool_t *scratch_pool)
+                  svn_node_kind_t target_kind,
+                  apr_pool_t *result_pool,
+                  apr_pool_t *scratch_pool)
 {
   const struct edit_baton *eb = pb->edit_baton;
-  svn_wc_conflict_version_t *src_left_version;
+  svn_wc_conflict_version_t *original_version;
+  svn_wc_conflict_version_t *target_version;
   svn_boolean_t is_complete;
 
   if (!conflict)
@@ -869,23 +873,34 @@ complete_conflict(svn_skel_t *conflict,
     return SVN_NO_ERROR; /* Already completed */
 
   if (old_repos_relpath)
-    src_left_version = svn_wc_conflict_version_create2(eb->repos_root,
+    original_version = svn_wc_conflict_version_create2(eb->repos_root,
                                                        eb->repos_uuid,
                                                        old_repos_relpath,
                                                        old_revision,
                                                        local_kind,
                                                        result_pool);
   else
-    src_left_version = NULL;
+    original_version = NULL;
 
+  if (new_repos_relpath)
+    target_version = svn_wc_conflict_version_create2(eb->repos_root,
+                                                        eb->repos_uuid,
+                                                        new_repos_relpath,
+                                                        *eb->target_revision,
+                                                        target_kind,
+                                                        result_pool);
+  else
+    target_version = NULL;
 
   if (eb->switch_relpath)
     SVN_ERR(svn_wc__conflict_skel_set_op_switch(conflict,
-                                                src_left_version,
+                                                original_version,
+                                                target_version,
                                                 result_pool, scratch_pool));
   else
     SVN_ERR(svn_wc__conflict_skel_set_op_update(conflict,
-                                                src_left_version,
+                                                original_version,
+                                                target_version,
                                                 result_pool, scratch_pool));
 
   return SVN_NO_ERROR;
@@ -910,8 +925,10 @@ mark_directory_edited(struct dir_baton *
       /* We have a (delayed) tree conflict to install */
 
       SVN_ERR(complete_conflict(db->edit_conflict, db->parent_baton,
-                                db->local_abspath, db->old_repos_relpath,
-                                db->old_revision, svn_node_dir,
+                                db->local_abspath,
+                                db->old_repos_relpath, db->old_revision,
+                                db->new_relpath,
+                                svn_node_dir, svn_node_dir,
                                 db->pool, scratch_pool));
       SVN_ERR(svn_wc__db_op_mark_conflict(db->edit_baton->db,
                                           db->local_abspath,
@@ -944,7 +961,8 @@ mark_file_edited(struct file_baton *fb, 
 
       SVN_ERR(complete_conflict(fb->edit_conflict, fb->dir_baton,
                                 fb->local_abspath, fb->old_repos_relpath,
-                                fb->old_revision, svn_node_file,
+                                fb->old_revision, fb->new_relpath,
+                                svn_node_file, svn_node_file,
                                 fb->pool, scratch_pool));
 
       SVN_ERR(svn_wc__db_op_mark_conflict(fb->edit_baton->db,
@@ -1750,10 +1768,11 @@ delete_entry(const char *path,
     }
 
   SVN_ERR(complete_conflict(tree_conflict, pb, local_abspath, repos_relpath,
-                            old_revision,
+                            old_revision, NULL,
                             (kind == svn_kind_dir)
                                 ? svn_node_dir
                                 : svn_node_file,
+                            svn_node_none,
                             pb->pool, scratch_pool));
 
   /* Issue a wq operation to delete the BASE_NODE data and to delete actual
@@ -2105,9 +2124,12 @@ add_directory(const char *path,
         }
     }
 
-  SVN_ERR(complete_conflict(tree_conflict, pb, db->local_abspath,
-                            db->old_repos_relpath, db->old_revision,
-                            wc_kind, db->pool, pool));
+  if (tree_conflict)
+    SVN_ERR(complete_conflict(tree_conflict, pb, db->local_abspath,
+                              db->old_repos_relpath, db->old_revision,
+                              db->new_relpath,
+                              wc_kind, svn_node_dir,
+                              db->pool, pool));
 
   SVN_ERR(svn_wc__db_base_add_incomplete_directory(
                                      eb->db, db->local_abspath,
@@ -2678,7 +2700,8 @@ close_directory(void *dir_baton,
                                     db->local_abspath,
                                     db->old_repos_relpath,
                                     db->old_revision,
-                                    svn_node_dir,
+                                    db->new_relpath,
+                                    svn_node_dir, svn_node_dir,
                                     db->pool, scratch_pool));
 
           SVN_ERR(svn_wc__conflict_create_markers(&work_item,
@@ -3193,7 +3216,8 @@ add_file(const char *path,
                                 fb->local_abspath,
                                 fb->old_repos_relpath,
                                 fb->old_revision,
-                                wc_kind,
+                                fb->new_relpath,
+                                wc_kind, svn_node_file,
                                 fb->pool, scratch_pool));
 
       SVN_ERR(svn_wc__db_op_mark_conflict(eb->db,
@@ -3556,7 +3580,8 @@ change_file_prop(void *file_baton,
 
           SVN_ERR(complete_conflict(fb->edit_conflict, fb->dir_baton,
                                     fb->local_abspath, fb->old_repos_relpath,
-                                    fb->old_revision, svn_node_file,
+                                    fb->old_revision, fb->new_relpath,
+                                    svn_node_file, svn_node_file,
                                     fb->pool, scratch_pool));
 
           /* Create a copy of the existing (pre update) BASE node in WORKING,
@@ -4264,7 +4289,8 @@ close_file(void *file_baton,
                                 fb->local_abspath,
                                 fb->old_repos_relpath,
                                 fb->old_revision,
-                                svn_node_file,
+                                fb->new_relpath,
+                                svn_node_file, svn_node_file,
                                 fb->pool, scratch_pool));
 
       SVN_ERR(svn_wc__conflict_create_markers(&work_item,

Modified: subversion/trunk/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/upgrade.c?rev=1430302&r1=1430301&r2=1430302&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/trunk/subversion/libsvn_wc/upgrade.c Tue Jan  8 14:35:07 2013
@@ -1466,12 +1466,14 @@ svn_wc__upgrade_conflict_skel_from_raw(s
           default:
             SVN_ERR(svn_wc__conflict_skel_set_op_update(conflict_data,
                                                        tc->src_left_version,
+                                                       tc->src_right_version,
                                                        scratch_pool,
                                                        scratch_pool));
             break;
           case svn_wc_operation_switch:
             SVN_ERR(svn_wc__conflict_skel_set_op_switch(conflict_data,
                                                         tc->src_left_version,
+                                                        tc->src_right_version,
                                                         scratch_pool,
                                                         scratch_pool));
             break;
@@ -1486,7 +1488,7 @@ svn_wc__upgrade_conflict_skel_from_raw(s
     }
   else if (conflict_data)
     {
-      SVN_ERR(svn_wc__conflict_skel_set_op_update(conflict_data, NULL,
+      SVN_ERR(svn_wc__conflict_skel_set_op_update(conflict_data, NULL, NULL,
                                                   scratch_pool,
                                                   scratch_pool));
     }

Modified: subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c?rev=1430302&r1=1430301&r2=1430302&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Tue Jan  8 14:35:07 2013
@@ -187,7 +187,8 @@ check_tree_conflict(svn_boolean_t *is_co
                                             kind,
                                             scratch_pool);
 
-  SVN_ERR(svn_wc__conflict_skel_set_op_update(conflict, version,
+  /* What about switch? */
+  SVN_ERR(svn_wc__conflict_skel_set_op_update(conflict, version, NULL /* wc_only */,
                                               scratch_pool, scratch_pool));
   SVN_ERR(svn_wc__db_mark_conflict_internal(b->wcroot, conflict_root_relpath,
                                             conflict, scratch_pool));
@@ -221,7 +222,9 @@ mark_unversioned_add_conflict(struct tc_
                                             kind,
                                             scratch_pool);
 
+  /* ### How about switch? */
   SVN_ERR(svn_wc__conflict_skel_set_op_update(conflict, version,
+                                              NULL /* wc_only */,
                                               scratch_pool, scratch_pool));
   SVN_ERR(svn_wc__db_mark_conflict_internal(b->wcroot, relpath,
                                             conflict, scratch_pool));
@@ -384,6 +387,7 @@ create_conflict_markers(svn_skel_t **wor
   original_version->node_kind = svn_node_file;
   SVN_ERR(svn_wc__conflict_skel_set_op_update(conflict_skel,
                                               original_version,
+                                              NULL /* wc_only */,
                                               scratch_pool,
                                               scratch_pool));
   /* According to this func's doc string, it is "Currently only used for
@@ -876,7 +880,6 @@ get_tc_info(svn_wc_operation_t *operatio
   const apr_array_header_t *locations;
   svn_boolean_t tree_conflicted;
   svn_skel_t *conflict_skel;
-  svn_kind_t kind;
 
   /* ### Check for mixed-rev src or dst? */
 
@@ -902,75 +905,11 @@ get_tc_info(svn_wc_operation_t *operatio
                                                     scratch_pool));
   if (locations)
     {
+      SVN_ERR_ASSERT(locations->nelts >= 2);
       *old_version = APR_ARRAY_IDX(locations, 0,
                                      svn_wc_conflict_version_t *);
-      if (locations->nelts > 1)
-        *new_version = APR_ARRAY_IDX(locations, 1,
-                                     svn_wc_conflict_version_t *);
-      else
-        {
-          const char *repos_root_url;
-          const char *repos_uuid;
-          const char *repos_relpath;
-          svn_revnum_t revision;
-          svn_node_kind_t node_kind;
-          svn_wc__db_status_t status;
-
-          /* The scan dance: read_info then scan_delete then base_get
-             or scan_addition.  Use the internal/relpath functions
-             here? */
-          SVN_ERR(svn_wc__db_read_info(&status, &kind, &revision,
-                                       &repos_relpath, &repos_root_url,
-                                       &repos_uuid, NULL, NULL, NULL, NULL,
-                                       NULL, NULL, NULL, NULL, NULL, NULL,
-                                       NULL, NULL, NULL, NULL, NULL, NULL,
-                                       NULL, NULL, NULL, NULL, NULL,
-                                       db, src_abspath, result_pool,
-                                       scratch_pool));
-          if (status == svn_wc__db_status_deleted)
-            {
-              const char *base_del_abspath, *work_del_abspath;
-              SVN_ERR(svn_wc__db_scan_deletion(&base_del_abspath, NULL,
-                                               &work_del_abspath,
-                                               NULL, db, src_abspath,
-                                               scratch_pool, scratch_pool));
-              SVN_ERR_ASSERT(base_del_abspath || work_del_abspath);
-              if (base_del_abspath)
-                {
-                  SVN_ERR(svn_wc__db_base_get_info(NULL, &kind, &revision,
-                                                   &repos_relpath,
-                                                   &repos_root_url,
-                                                   &repos_uuid,
-                                                   NULL, NULL, NULL, NULL, NULL,
-                                                   NULL, NULL, NULL, NULL, NULL,
-                                                   db, src_abspath, result_pool,
-                                                   scratch_pool));
-                }
-              else if (work_del_abspath)
-                {
-                  work_del_abspath = svn_dirent_dirname(work_del_abspath,
-                                                        scratch_pool);
-                  SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, &repos_relpath,
-                                                   &repos_root_url, &repos_uuid,
-                                                   NULL, NULL, NULL,
-                                                   &revision, NULL, NULL,
-                                                   db, work_del_abspath,
-                                                   scratch_pool, scratch_pool));
-                  repos_relpath = svn_relpath_join(repos_relpath,
-                                     svn_dirent_skip_ancestor(work_del_abspath,
-                                                              src_abspath),
-                                                   scratch_pool);
-                }
-            }
-
-          node_kind = svn__node_kind_from_kind(kind);
-          *new_version = svn_wc_conflict_version_create2(repos_root_url,
-                                                         repos_uuid,
-                                                         repos_relpath,
-                                                         revision,
-                                                         node_kind,
-                                                         scratch_pool);
-        }
+      *new_version = APR_ARRAY_IDX(locations, 1,
+                                   svn_wc_conflict_version_t *);
     }
 
   SVN_ERR(svn_wc__conflict_read_tree_conflict(local_change,

Modified: subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c?rev=1430302&r1=1430301&r2=1430302&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c Tue Jan  8 14:35:07 2013
@@ -337,6 +337,7 @@ test_serialize_prop_conflict(const svn_t
                         svn_wc_conflict_version_create2("http://my-repos/svn",
                                                         "uuid", "trunk", 12,
                                                         svn_node_dir, pool),
+                        NULL /* wc_only */,
                         pool, pool));
 
   SVN_ERR(svn_wc__conflict_skel_is_complete(&complete, conflict_skel));
@@ -510,6 +511,7 @@ test_serialize_tree_conflict(const svn_t
                         svn_wc_conflict_version_create2("http://my-repos/svn",
                                                         "uuid", "trunk", 12,
                                                         svn_node_dir, pool),
+                        NULL /* wc_only */,
                         pool, pool));
 
   SVN_ERR(svn_wc__conflict_skel_is_complete(&complete, conflict_skel));