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/02/07 15:11:38 UTC

svn commit: r1443492 - in /subversion/trunk: subversion/include/private/ subversion/libsvn_client/ subversion/libsvn_wc/ subversion/tests/libsvn_wc/ tools/dev/svnraisetreeconflict/

Author: rhuijben
Date: Thu Feb  7 14:11:37 2013
New Revision: 1443492

URL: http://svn.apache.org/viewvc?rev=1443492&view=rev
Log:
Following up on r1443451, make the path stored for local-moved-away tree
conflicts no longer required for conflicts raised by merge operations.
(In other words: only required for update and switch.)

Merge doesn't have the power to look in the deeper layers of WC-NG,
nor do we intend to expose them to libsvn_client.

* subversion/include/private/svn_wc_private.h
  (svn_wc__add_tree_conflict): Update comment. Remove argument.

* subversion/libsvn_client/merge.c
  (record_tree_conflict): Update caller.

* subversion/libsvn_wc/conflicts.c
  (svn_wc__conflict_skel_add_tree_conflict): Only store moved away
    path when provided and valid for this state.
  (svn_wc__conflict_read_tree_conflict): Allow reading just the path,
    and handle move conflicts without path

* subversion/libsvn_wc/tree_conflicts.c
  (svn_wc__add_tree_conflict): Verify requirements for new in 1.8 values.
    Always pass NULL for path to svn_wc__conflict_skel_add_tree_conflict.

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

* tools/dev/svnraisetreeconflict/svnraisetreeconflict.c
  (raise_tree_conflict): Update caller.

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/libsvn_wc/conflicts.c
    subversion/trunk/subversion/libsvn_wc/tree_conflicts.c
    subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c
    subversion/trunk/tools/dev/svnraisetreeconflict/svnraisetreeconflict.c

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1443492&r1=1443491&r2=1443492&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Thu Feb  7 14:11:37 2013
@@ -305,11 +305,13 @@ svn_wc__get_tree_conflict(const svn_wc_c
  *
  * Returns an SVN_ERR_WC_PATH_UNEXPECTED_STATUS error when
  * CONFLICT->LOCAL_ABSPATH is already tree conflicted.
+ *
+ * ### This function can't set moved_away, moved_here conflicts for
+ *     any operation, except merges.
  */
 svn_error_t *
 svn_wc__add_tree_conflict(svn_wc_context_t *wc_ctx,
                           const svn_wc_conflict_description2_t *conflict,
-                          const char *moved_away_op_root_abspath,
                           apr_pool_t *scratch_pool);
 
 /* Remove any tree conflict on victim @a victim_abspath using @a wc_ctx.

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1443492&r1=1443491&r2=1443492&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Thu Feb  7 14:11:37 2013
@@ -1322,7 +1322,6 @@ record_tree_conflict(merge_cmd_baton_t *
        svn_wc_conflict_description2_t *conflict;
        const svn_wc_conflict_version_t *left;
        const svn_wc_conflict_version_t *right;
-       const char *moved_away_op_root_abspath = NULL;
        apr_pool_t *result_pool = parent_baton ? parent_baton->pool
                                               : scratch_pool;
 
@@ -1336,16 +1335,9 @@ record_tree_conflict(merge_cmd_baton_t *
 
           if (moved_to_abspath)
             {
-              /* Local abspath has been moved away itself, as we only create
-                 tree conflict on the obstructing op-root.
-
-                 If only a descendant is moved away, we call the node itself
-                 deleted. */
+              /* Local abspath itself has been moved away. If only a
+                 descendant is moved away, we call the node itself deleted */
               reason = svn_wc_conflict_reason_moved_away;
-              moved_away_op_root_abspath = local_abspath; /* ### NOT OK */
-              /* local_abspath would be nonsense as that is what the conflict
-                 is on, and the move destination should be obtained by another
-                 api as that might just change while the conflict exists */
             }
         }
       else if (reason == svn_wc_conflict_reason_added)
@@ -1379,7 +1371,6 @@ record_tree_conflict(merge_cmd_baton_t *
                                           scratch_pool));
 
       SVN_ERR(svn_wc__add_tree_conflict(merge_b->ctx->wc_ctx, conflict,
-                                        moved_away_op_root_abspath,
                                         scratch_pool));
 
       if (parent_baton)

Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=1443492&r1=1443491&r2=1443492&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Thu Feb  7 14:11:37 2013
@@ -549,13 +549,13 @@ svn_wc__conflict_skel_add_tree_conflict(
 
   SVN_ERR_ASSERT(!tree_conflict); /* ### Use proper error? */
 
-  SVN_ERR_ASSERT((local_change != svn_wc_conflict_reason_moved_away
-                  && !moved_away_op_root_abspath)
-                 || moved_away_op_root_abspath); /* ### Use proper error? */
+  SVN_ERR_ASSERT(local_change == svn_wc_conflict_reason_moved_away
+                 || !moved_away_op_root_abspath); /* ### Use proper error? */
 
   tree_conflict = svn_skel__make_empty_list(result_pool);
 
-  if (local_change == svn_wc_conflict_reason_moved_away)
+  if (local_change == svn_wc_conflict_reason_moved_away
+      && moved_away_op_root_abspath)
     {
       const char *moved_away_op_root_relpath;
 
@@ -956,16 +956,18 @@ svn_wc__conflict_read_tree_conflict(svn_
 
   c = c->next; /* Skip markers */
 
-  if (local_change)
-    {
-      int value = svn_token__from_mem(local_change_map, c->data, c->len);
+  {
+    int value = svn_token__from_mem(local_change_map, c->data, c->len);
 
-      if (value != SVN_TOKEN_UNKNOWN)
-        *local_change = value;
-      else
-        *local_change = svn_wc_conflict_reason_edited;
+    if (local_change)
+      {
+        if (value != SVN_TOKEN_UNKNOWN)
+          *local_change = value;
+        else
+          *local_change = svn_wc_conflict_reason_edited;
+      }
 
-      is_moved_away = *local_change == svn_wc_conflict_reason_moved_away;
+      is_moved_away = (value == svn_wc_conflict_reason_moved_away);
     }
   c = c->next;
 
@@ -981,15 +983,21 @@ svn_wc__conflict_read_tree_conflict(svn_
 
   c = c->next;
 
-  if (is_moved_away && moved_away_op_root_abspath)
+  if (moved_away_op_root_abspath)
     {
-      const char *moved_away_op_root_relpath = apr_pstrmemdup(scratch_pool,
-                                                              c->data, c->len);
+      /* Only set for update and switch tree conflicts */
+      if (c && is_moved_away)
+        {
+          const char *moved_away_op_root_relpath
+                            = apr_pstrmemdup(scratch_pool, c->data, c->len);
 
-      SVN_ERR(svn_wc__db_from_relpath(moved_away_op_root_abspath,
-                                      db, wri_abspath,
-                                      moved_away_op_root_relpath,
-                                      result_pool, scratch_pool));
+          SVN_ERR(svn_wc__db_from_relpath(moved_away_op_root_abspath,
+                                          db, wri_abspath,
+                                          moved_away_op_root_relpath,
+                                          result_pool, scratch_pool));
+        }
+      else
+        *moved_away_op_root_abspath = NULL;
     }
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_wc/tree_conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/tree_conflicts.c?rev=1443492&r1=1443491&r2=1443492&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/tree_conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/tree_conflicts.c Thu Feb  7 14:11:37 2013
@@ -400,13 +400,18 @@ svn_wc__del_tree_conflict(svn_wc_context
 svn_error_t *
 svn_wc__add_tree_conflict(svn_wc_context_t *wc_ctx,
                           const svn_wc_conflict_description2_t *conflict,
-                          const char *moved_away_op_root_abspath,
                           apr_pool_t *scratch_pool)
 {
   svn_boolean_t existing_conflict;
   svn_skel_t *conflict_skel;
   svn_error_t *err;
 
+  SVN_ERR_ASSERT(conflict != NULL);
+  SVN_ERR_ASSERT(conflict->operation == svn_wc_operation_merge
+                 || (conflict->reason != svn_wc_conflict_reason_moved_away
+                     && conflict->reason != svn_wc_conflict_reason_moved_here)
+                );
+
   /* Re-adding an existing tree conflict victim is an error. */
   err = svn_wc__internal_conflicted_p(NULL, NULL, &existing_conflict,
                                       wc_ctx->db, conflict->local_abspath,
@@ -433,7 +438,7 @@ svn_wc__add_tree_conflict(svn_wc_context
                                                   conflict->local_abspath,
                                                   conflict->reason,
                                                   conflict->action,
-                                                  moved_away_op_root_abspath,
+                                                  NULL,
                                                   scratch_pool, scratch_pool));
 
   switch(conflict->operation)

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=1443492&r1=1443491&r2=1443492&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c Thu Feb  7 14:11:37 2013
@@ -229,9 +229,9 @@ test_read_write_tree_conflicts(const svn
 
   /* Write */
   SVN_ERR(svn_wc__add_tree_conflict(sbox.wc_ctx, /*child1_abspath,*/
-                                    conflict1, NULL, pool));
+                                    conflict1, pool));
   SVN_ERR(svn_wc__add_tree_conflict(sbox.wc_ctx, /*child2_abspath,*/
-                                    conflict2, NULL, pool));
+                                    conflict2, pool));
 
   /* Query (conflict1 through WC-DB API, conflict2 through WC API) */
   {

Modified: subversion/trunk/tools/dev/svnraisetreeconflict/svnraisetreeconflict.c
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dev/svnraisetreeconflict/svnraisetreeconflict.c?rev=1443492&r1=1443491&r2=1443492&view=diff
==============================================================================
--- subversion/trunk/tools/dev/svnraisetreeconflict/svnraisetreeconflict.c (original)
+++ subversion/trunk/tools/dev/svnraisetreeconflict/svnraisetreeconflict.c Thu Feb  7 14:11:37 2013
@@ -229,7 +229,7 @@ raise_tree_conflict(int argc, const char
 
   /* Raise the conflict */
   SVN_ERR(svn_wc_context_create(&wc_ctx, NULL, pool, pool));
-  SVN_ERR(svn_wc__add_tree_conflict(wc_ctx, c, NULL, pool));
+  SVN_ERR(svn_wc__add_tree_conflict(wc_ctx, c, pool));
 
   return SVN_NO_ERROR;
 }