You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2010/04/24 01:54:29 UTC
svn commit: r937556 - in /subversion/trunk/subversion/libsvn_wc: conflicts.c
conflicts.h
Author: gstein
Date: Fri Apr 23 23:54:29 2010
New Revision: 937556
URL: http://svn.apache.org/viewvc?rev=937556&view=rev
Log:
Begin implementation of the new conflict skel APIs. Starting with the
property conflict recording.
* subversion/libsvn_wc/conflicts.h:
(SVN_WC__CONFLICT_*): new defines
(svn_wc__conflict_skel_add_prop_conflict): update docstring and add an
INCOMING_BASE_VALUE param
* subversion/libsvn_wc/conflicts.c:
(): adjust includes
(svn_wc__conflict_skel_new): build and return an empty conflict skel
(prepend_prop_value): create a list to hold a property value. if the
value is present, then put an atom into the list
(svn_wc__conflict_skel_add_prop_conflict): new implementation
Modified:
subversion/trunk/subversion/libsvn_wc/conflicts.c
subversion/trunk/subversion/libsvn_wc/conflicts.h
Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=937556&r1=937555&r2=937556&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Fri Apr 23 23:54:29 2010
@@ -30,8 +30,6 @@
#include <apr_pools.h>
#include <apr_tables.h>
#include <apr_hash.h>
-#include <apr_file_io.h>
-#include <apr_time.h>
#include <apr_errno.h>
#include "svn_types.h"
@@ -44,14 +42,13 @@
#include "svn_diff.h"
#include "wc.h"
-#include "log.h"
-#include "adm_ops.h"
-#include "props.h"
-#include "tree_conflicts.h"
-#include "workqueue.h"
+#include "wc_db.h"
+#include "conflicts.h"
-#include "svn_private_config.h"
#include "private/svn_wc_private.h"
+#include "private/svn_skel.h"
+
+#include "svn_private_config.h"
struct svn_wc_conflict_t
{
@@ -198,6 +195,69 @@ svn_wc_get_property_conflict_data(const
SVN_ERR_MALFUNCTION(); /* ### Not implemented yet */
}
+
+svn_skel_t *
+svn_wc__conflict_skel_new(apr_pool_t *result_pool)
+{
+ svn_skel_t *operation = svn_skel__make_empty_list(result_pool);
+ svn_skel_t *result = svn_skel__make_empty_list(result_pool);
+
+ svn_skel__prepend(operation, result);
+ return result;
+}
+
+
+static void
+prepend_prop_value(const svn_string_t *value,
+ svn_skel_t *skel,
+ apr_pool_t *result_pool)
+{
+ svn_skel_t *value_skel = svn_skel__make_empty_list(result_pool);
+
+ if (value != NULL)
+ {
+ const void *dup = apr_pmemdup(result_pool, value->data, value->len);
+
+ svn_skel__prepend(svn_skel__mem_atom(dup, value->len, result_pool),
+ value_skel);
+ }
+
+ svn_skel__prepend(value_skel, skel);
+}
+
+
+svn_error_t *
+svn_wc__conflict_skel_add_prop_conflict(
+ svn_skel_t *skel,
+ const char *prop_name,
+ const svn_string_t *original_value,
+ const svn_string_t *mine_value,
+ const svn_string_t *incoming_value,
+ const svn_string_t *incoming_base_value,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_skel_t *prop_skel = svn_skel__make_empty_list(result_pool);
+
+ /* ### check that OPERATION has been filled in. */
+
+ /* See notes/wc-ng/conflict-storage */
+ prepend_prop_value(incoming_base_value, prop_skel, result_pool);
+ prepend_prop_value(incoming_value, prop_skel, result_pool);
+ prepend_prop_value(mine_value, prop_skel, result_pool);
+ prepend_prop_value(original_value, prop_skel, result_pool);
+ svn_skel__prepend_str(apr_pstrdup(result_pool, prop_name), prop_skel,
+ result_pool);
+ svn_skel__prepend_str(SVN_WC__CONFLICT_KIND_PROP, prop_skel, result_pool);
+
+ /* Now we append PROP_SKEL to the end of the provided conflict SKEL. */
+ svn_skel__append(skel, prop_skel);
+
+ return SVN_NO_ERROR;
+}
+
+
+
/*** Resolving a conflict automatically ***/
Modified: subversion/trunk/subversion/libsvn_wc/conflicts.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.h?rev=937556&r1=937555&r2=937556&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.h (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.h Fri Apr 23 23:54:29 2010
@@ -38,6 +38,19 @@ extern "C" {
+#define SVN_WC__CONFLICT_OP_UPDATE "update"
+#define SVN_WC__CONFLICT_OP_SWITCH "switch"
+#define SVN_WC__CONFLICT_OP_MERGE "merge"
+#define SVN_WC__CONFLICT_OP_PATCH "patch"
+
+#define SVN_WC__CONFLICT_KIND_TEXT "text"
+#define SVN_WC__CONFLICT_KIND_PROP "prop"
+#define SVN_WC__CONFLICT_KIND_TREE "tree"
+#define SVN_WC__CONFLICT_KIND_REJECT "reject"
+#define SVN_WC__CONFLICT_KIND_OBSTRUCTED "obstructed"
+
+
+
/* Return a new conflict skel, allocated in RESULT_POOL. */
svn_skel_t *
svn_wc__conflict_skel_new(apr_pool_t *result_pool);
@@ -147,24 +160,26 @@ svn_wc__conflict_skel_add_text_conflict(
apr_pool_t *scratch_pool);
-/* Add a property conflict to CONFLICT_SKEL.
+/* Add a property conflict to SKEL.
PROP_NAME is the name of the conflicted property.
- ORIGINAL_VALUE is a stream of the property's value at the BASE revision.
- MINE_VALUE is a stream of the property's value in WORKING (BASE + local
- modifications). INCOMING_VALUE is a stream of the incoming property
- value brought in by the operation. ### Is this enough? What about merge?
+ ORIGINAL_VALUE is the property's value at the BASE revision. MINE_VALUE
+ is the property's value in WORKING (BASE + local modifications).
+ INCOMING_VALUE is the incoming property value brought in by the
+ operation. When merging, INCOMING_BASE_VALUE is the base value against
+ which INCOMING_VALUE ws being applied. For updates, INCOMING_BASE_VALUE
+ should be the same as ORIGINAL_VALUE.
- ORIGINAL/MINE/INCOMING_VALUE may be NULL, indicating no value was
- present.
+ *_VALUE may be NULL, indicating no value was present.
It is an error (### which one?) if no conflicting operation has been
set on CONFLICT_SKEL before calling this function.
It is an error (### which one?) if CONFLICT_SKEL already cotains
a propery conflict for PROP_NAME.
- Do temporary allocations in SCRATCH_POOL.
+ The conflict recorded in SKEL will be allocated from RESULT_POOL. Do
+ temporary allocations in SCRATCH_POOL.
*/
svn_error_t *
svn_wc__conflict_skel_add_prop_conflict(
@@ -173,6 +188,7 @@ svn_wc__conflict_skel_add_prop_conflict(
const svn_string_t *original_value,
const svn_string_t *mine_value,
const svn_string_t *incoming_value,
+ const svn_string_t *incoming_base_value,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);