subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1355017 - in /subversion/trunk/subversion: libsvn_wc/conflicts.c libsvn_wc/conflicts.h tests/libsvn_wc/conflict-data-test.c
Date Thu, 28 Jun 2012 14:20:16 GMT
Author: rhuijben
Date: Thu Jun 28 14:20:15 2012
New Revision: 1355017

URL: http://svn.apache.org/viewvc?rev=1355017&view=rev
Log:
Implement storing an operation in the conflict-2.0 skels.

* subversion/libsvn_wc/conflicts.c
  (conflict__prepend_location,
   svn_wc__conflict_skel_set_op_update,
   svn_wc__conflict_skel_set_op_switch,
   svn_wc__conflict_skel_set_op_merge): New functions.

* subversion/libsvn_wc/conflicts.h
  (SVN_WC__CONFLICT_SRC_SUBVERSION): New define.
  (svn_wc__conflict_skel_set_op_update,
   svn_wc__conflict_skel_set_op_switch,
   svn_wc__conflict_skel_set_op_merge): Make origins constant.

* subversion/tests/libsvn_wc/conflict-data-test.c
  (test_serialize_prop_conflict): Set operation and verify that this makes
    the conflict complete.

Modified:
    subversion/trunk/subversion/libsvn_wc/conflicts.c
    subversion/trunk/subversion/libsvn_wc/conflicts.h
    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=1355017&r1=1355016&r2=1355017&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Thu Jun 28 14:20:15 2012
@@ -90,6 +90,134 @@ svn_wc__conflict_skel_is_complete(svn_bo
   return SVN_NO_ERROR;
 }
 
+/* Serialize a svn_wc_conflict_version_t before the existing data in skel */
+static svn_error_t *
+conflict__prepend_location(svn_skel_t *skel,
+                           const svn_wc_conflict_version_t *location,
+                           svn_boolean_t allow_NULL,
+                           apr_pool_t *result_pool,
+                           apr_pool_t *scratch_pool)
+{
+  svn_skel_t *loc;
+  SVN_ERR_ASSERT(location || allow_NULL);
+
+  if (!location)
+    {
+      svn_skel__prepend(svn_skel__make_empty_list(result_pool), skel);
+      return SVN_NO_ERROR;
+    }
+
+  /* ("subversion" repos_root_url repos_uuid repos_relpath rev kind) */
+  loc = svn_skel__make_empty_list(result_pool);
+
+  svn_skel__prepend_str(svn_node_kind_to_word(location->node_kind),
+                        loc, result_pool);
+
+  svn_skel__prepend_int(location->peg_rev, loc, result_pool);
+
+  svn_skel__prepend_str(apr_pstrdup(result_pool, location->path_in_repos), loc,
+                        result_pool);
+
+  if (!location->repos_uuid) /* Can theoretically be NULL */
+    svn_skel__prepend(svn_skel__make_empty_list(result_pool), loc);
+
+  svn_skel__prepend_str(apr_pstrdup(result_pool, location->repos_url), loc,
+                        result_pool);
+
+  svn_skel__prepend_str(SVN_WC__CONFLICT_SRC_SUBVERSION, loc, result_pool);
+
+  svn_skel__prepend(loc, skel);
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc__conflict_skel_set_op_update(svn_skel_t *conflict_skel,
+                                    const svn_wc_conflict_version_t *original,
+                                    apr_pool_t *result_pool,
+                                    apr_pool_t *scratch_pool)
+{
+  svn_skel_t *why;
+  svn_skel_t *origins;
+
+  SVN_ERR_ASSERT(conflict_skel
+                 && conflict_skel->children
+                 && conflict_skel->children->next
+                 && !conflict_skel->children->next->is_atom);
+
+
+  why = conflict_skel->children;
+
+  origins = svn_skel__make_empty_list(result_pool);
+
+  SVN_ERR(conflict__prepend_location(origins, original, FALSE,
+                                     result_pool, scratch_pool));
+
+  svn_skel__prepend(origins, why);
+  svn_skel__prepend_str(SVN_WC__CONFLICT_OP_UPDATE, why, result_pool);
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc__conflict_skel_set_op_switch(svn_skel_t *conflict_skel,
+                                    const svn_wc_conflict_version_t *original,
+                                    apr_pool_t *result_pool,
+                                    apr_pool_t *scratch_pool)
+{
+  svn_skel_t *why;
+  svn_skel_t *origins;
+
+  SVN_ERR_ASSERT(conflict_skel
+                 && conflict_skel->children
+                 && conflict_skel->children->next
+                 && !conflict_skel->children->next->is_atom);
+
+
+  why = conflict_skel->children;
+
+  origins = svn_skel__make_empty_list(result_pool);
+
+  SVN_ERR(conflict__prepend_location(origins, original, FALSE,
+                                     result_pool, scratch_pool));
+
+  svn_skel__prepend(origins, why);
+  svn_skel__prepend_str(SVN_WC__CONFLICT_OP_SWITCH, why, result_pool);
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc__conflict_skel_set_op_merge(svn_skel_t *conflict_skel,
+                                   const svn_wc_conflict_version_t *left,
+                                   const svn_wc_conflict_version_t *right,
+                                   apr_pool_t *result_pool,
+                                   apr_pool_t *scratch_pool)
+{
+  svn_skel_t *why;
+  svn_skel_t *origins;
+
+  SVN_ERR_ASSERT(conflict_skel
+                 && conflict_skel->children
+                 && conflict_skel->children->next
+                 && !conflict_skel->children->next->is_atom);
+
+
+  why = conflict_skel->children;
+
+  origins = svn_skel__make_empty_list(result_pool);
+
+  SVN_ERR(conflict__prepend_location(origins, right, TRUE,
+                                     result_pool, scratch_pool));
+
+  SVN_ERR(conflict__prepend_location(origins, left, TRUE,
+                                     result_pool, scratch_pool));
+
+  svn_skel__prepend(origins, why);
+  svn_skel__prepend_str(SVN_WC__CONFLICT_OP_UPDATE, why, result_pool);
+
+  return SVN_NO_ERROR;
+}
+
 /* Gets the conflict data of the specified type CONFLICT_TYPE from
    CONFLICT_SKEL, or NULL if no such conflict is recorded */
 static svn_error_t *

Modified: subversion/trunk/subversion/libsvn_wc/conflicts.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.h?rev=1355017&r1=1355016&r2=1355017&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.h (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.h Thu Jun 28 14:20:15 2012
@@ -49,6 +49,8 @@ extern "C" {
 #define SVN_WC__CONFLICT_KIND_REJECT "reject"
 #define SVN_WC__CONFLICT_KIND_OBSTRUCTED "obstructed"
 
+#define SVN_WC__CONFLICT_SRC_SUBVERSION "subversion"
+
 /* Return a new conflict skel, allocated in RESULT_POOL.
 
    Typically creating a conflict starts with calling this function and then
@@ -87,7 +89,7 @@ svn_wc__conflict_skel_is_complete(svn_bo
    completely stored in RESULT-POOL. */
 svn_error_t *
 svn_wc__conflict_skel_set_op_update(svn_skel_t *conflict_skel,
-                                    svn_wc_conflict_version_t *original,
+                                    const svn_wc_conflict_version_t *original,
                                     apr_pool_t *result_pool,
                                     apr_pool_t *scratch_pool);
 
@@ -103,7 +105,7 @@ svn_wc__conflict_skel_set_op_update(svn_
    Do temporary allocations in SCRATCH_POOL. */
 svn_error_t *
 svn_wc__conflict_skel_set_op_switch(svn_skel_t *conflict_skel,
-                                    svn_wc_conflict_version_t *original,
+                                    const svn_wc_conflict_version_t *original,
                                     apr_pool_t *result_pool,
                                     apr_pool_t *scratch_pool);
 
@@ -120,8 +122,8 @@ svn_wc__conflict_skel_set_op_switch(svn_
    Do temporary allocations in SCRATCH_POOL. */
 svn_error_t *
 svn_wc__conflict_skel_set_op_merge(svn_skel_t *conflict_skel,
-                                   svn_wc_conflict_version_t *left,
-                                   svn_wc_conflict_version_t *right,
+                                   const svn_wc_conflict_version_t *left,
+                                   const svn_wc_conflict_version_t *right,
                                    apr_pool_t *result_pool,
                                    apr_pool_t *scratch_pool);
 

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=1355017&r1=1355016&r2=1355017&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c Thu Jun 28 14:20:15 2012
@@ -344,7 +344,15 @@ test_serialize_prop_conflict(const svn_t
   SVN_ERR(svn_wc__conflict_skel_is_complete(&complete, conflict_skel, pool));
   SVN_TEST_ASSERT(!complete); /* Misses operation */
 
-  /* TODO: Set operation and verify complete */
+  SVN_ERR(svn_wc__conflict_skel_set_op_update(
+                        conflict_skel,
+                        svn_wc_conflict_version_create2("http://my-repos/svn",
+                                                        "uuid", "trunk", 12,
+                                                        svn_node_dir, pool),
+                        pool, pool));
+
+  SVN_ERR(svn_wc__conflict_skel_is_complete(&complete, conflict_skel, pool));
+  SVN_TEST_ASSERT(complete); /* Everything available */
 
   {
     apr_hash_t *old;



Mime
View raw message