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 2012/06/30 18:58:02 UTC

svn commit: r1355767 - in /subversion/trunk/subversion: libsvn_wc/tree_conflicts.c libsvn_wc/wc_db.c libsvn_wc/wc_db.h tests/libsvn_wc/conflict-data-test.c

Author: rhuijben
Date: Sat Jun 30 16:58:01 2012
New Revision: 1355767

URL: http://svn.apache.org/viewvc?rev=1355767&view=rev
Log:
Make svn_wc__add_tree_conflict() install tree conflicts via the new conflict
skels. This allows removing the old internal api to directly set tree
conflicts.

* subversion/libsvn_wc/tree_conflicts.c
  (includes): Add conflicts.h.
  (svn_wc__del_tree_conflict): Use svn_wc__db_op_mark_resolved().
  (svn_wc__add_tree_conflict): Handle no-op case. Create conflict skel instead
    of pushing the tree conflict into the db api.

* subversion/libsvn_wc/wc_db.c
  (mark_conflict): Reorder type priority, to fix a c testcase.
  (svn_wc__db_op_set_tree_conflict): Remove funtion.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_op_set_tree_conflict): Remove funtion.

* subversion/tests/libsvn_wc/conflict-data-test.c
  (test_read_write_tree_conflicts): Create a merge skel if we want to contain
    two urls. Only use the internal api.

Modified:
    subversion/trunk/subversion/libsvn_wc/tree_conflicts.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h
    subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c

Modified: subversion/trunk/subversion/libsvn_wc/tree_conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/tree_conflicts.c?rev=1355767&r1=1355766&r2=1355767&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/tree_conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/tree_conflicts.c Sat Jun 30 16:58:01 2012
@@ -27,6 +27,7 @@
 #include "svn_pools.h"
 
 #include "tree_conflicts.h"
+#include "conflicts.h"
 #include "wc.h"
 
 #include "private/svn_skel.h"
@@ -389,8 +390,9 @@ svn_wc__del_tree_conflict(svn_wc_context
 {
   SVN_ERR_ASSERT(svn_dirent_is_absolute(victim_abspath));
 
-  SVN_ERR(svn_wc__db_op_set_tree_conflict(wc_ctx->db, victim_abspath,
-                                          NULL, scratch_pool));
+  SVN_ERR(svn_wc__db_op_mark_resolved(wc_ctx->db, victim_abspath,
+                                      FALSE, FALSE, TRUE, NULL,
+                                      scratch_pool));
 
    return SVN_NO_ERROR;
  }
@@ -401,6 +403,7 @@ svn_wc__add_tree_conflict(svn_wc_context
                           apr_pool_t *scratch_pool)
 {
   const svn_wc_conflict_description2_t *existing_conflict;
+  svn_skel_t *conflict_skel;
 
   /* Re-adding an existing tree conflict victim is an error. */
   SVN_ERR(svn_wc__db_op_read_tree_conflict(&existing_conflict, wc_ctx->db,
@@ -412,10 +415,41 @@ svn_wc__add_tree_conflict(svn_wc_context
                                "exists at '%s'"),
                              svn_dirent_local_style(conflict->local_abspath,
                                                     scratch_pool));
+  else if (!conflict)
+    return SVN_NO_ERROR;
+
+  conflict_skel = svn_wc__conflict_skel_create(scratch_pool);
+
+  SVN_ERR(svn_wc__conflict_skel_add_tree_conflict(conflict_skel, wc_ctx->db,
+                                                  conflict->local_abspath,
+                                                  conflict->reason,
+                                                  conflict->action,
+                                                  scratch_pool, scratch_pool));
+
+  switch(conflict->operation)
+    {
+      case svn_wc_operation_update:
+      default:
+        SVN_ERR(svn_wc__conflict_skel_set_op_update(conflict_skel,
+                                                    conflict->src_left_version,
+                                                    scratch_pool, scratch_pool));
+        break;
+      case svn_wc_operation_switch:
+        SVN_ERR(svn_wc__conflict_skel_set_op_switch(conflict_skel,
+                                                    conflict->src_left_version,
+                                                    scratch_pool, scratch_pool));
+        break;
+      case svn_wc_operation_merge:
+        SVN_ERR(svn_wc__conflict_skel_set_op_merge(conflict_skel,
+                                                   conflict->src_left_version,
+                                                   conflict->src_right_version,
+                                                   scratch_pool, scratch_pool));
+        break;
+    }
 
   return svn_error_trace(
-    svn_wc__db_op_set_tree_conflict(wc_ctx->db, conflict->local_abspath,
-                                          conflict, scratch_pool));
+                svn_wc__db_op_mark_conflict(wc_ctx->db, conflict->local_abspath,
+                                            conflict_skel, NULL, scratch_pool));
 }
 
 

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1355767&r1=1355766&r2=1355767&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Sat Jun 30 16:58:01 2012
@@ -5363,10 +5363,10 @@ mark_conflict(svn_wc__db_wcroot_t *wcroo
             }
           else
             {
-              if (v2)
-                tc_kind = v2->node_kind;
-              else if (v1)
+              if (v1)
                 tc_kind = v1->node_kind;
+              else if (v2)
+                tc_kind = v2->node_kind;
               else
                 tc_kind = svn_node_file; /* Avoid assertion */
             }
@@ -5578,32 +5578,6 @@ temp_op_set_tree_conflict(void *baton,
   return SVN_NO_ERROR;
 }
 
-
-svn_error_t *
-svn_wc__db_op_set_tree_conflict(svn_wc__db_t *db,
-                                const char *local_abspath,
-                                const svn_wc_conflict_description2_t *tree_conflict,
-                                apr_pool_t *scratch_pool)
-{
-  svn_wc__db_wcroot_t *wcroot;
-  const char *local_relpath;
-
-  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
-
-  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
-                              db, local_abspath, scratch_pool, scratch_pool));
-  VERIFY_USABLE_WCROOT(wcroot);
-
-  SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, temp_op_set_tree_conflict,
-                              (void *) tree_conflict, scratch_pool));
-
-  /* There may be some entries, and the conflict info is now out of date.  */
-  SVN_ERR(flush_entries(wcroot, local_abspath, svn_depth_empty, scratch_pool));
-
-  return SVN_NO_ERROR;
-}
-
-
 /* Clear moved-to information at the delete-half of the move which
  * moved LOCAL_RELPATH here. This transforms the move into a simple delete. */
 static svn_error_t *

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1355767&r1=1355766&r2=1355767&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Sat Jun 30 16:58:01 2012
@@ -1645,21 +1645,6 @@ svn_wc__db_op_read_tree_conflict(
                      apr_pool_t *scratch_pool);
 
 
-/* Set the tree conflict on LOCAL_ABSPATH in DB to TREE_CONFLICT.  Use
-   NULL to remove a tree conflict.
-
-   Use SCRATCH_POOL for any temporary allocations.
-*/
-/* ### can this also record text/prop conflicts? drop "tree"? */
-/* ### dunno if it can, but it definitely should be able to. */
-/* ### gjs: also ref: db_op_mark_conflict()  */
-svn_error_t *
-svn_wc__db_op_set_tree_conflict(svn_wc__db_t *db,
-                                const char *local_abspath,
-                                const svn_wc_conflict_description2_t *tree_conflict,
-                                apr_pool_t *scratch_pool);
-
-
 /* ### status */
 
 

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=1355767&r1=1355766&r2=1355767&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c Sat Jun 30 16:58:01 2012
@@ -205,7 +205,7 @@ test_read_write_tree_conflicts(const svn
   child2_abspath = svn_dirent_join(parent_abspath, "bar", pool);
 
   conflict1 = tree_conflict_create(child1_abspath, svn_node_file,
-                                   svn_wc_operation_update,
+                                   svn_wc_operation_merge,
                                    svn_wc_conflict_action_delete,
                                    svn_wc_conflict_reason_edited,
                                    "dummy://localhost", "path/to/foo",
@@ -224,9 +224,9 @@ test_read_write_tree_conflicts(const svn
                                    52, svn_node_file,
                                    pool);
 
-  /* Write (conflict1 through WC-DB API, conflict2 through WC API) */
-  SVN_ERR(svn_wc__db_op_set_tree_conflict(sbox.wc_ctx->db, child1_abspath,
-                                          conflict1, pool));
+  /* Write */
+  SVN_ERR(svn_wc__add_tree_conflict(sbox.wc_ctx, /*child1_abspath,*/
+                                    conflict1, pool));
   SVN_ERR(svn_wc__add_tree_conflict(sbox.wc_ctx, /*child2_abspath,*/
                                     conflict2, pool));