Author: stsp
Date: Thu Jun 20 13:38:41 2013
New Revision: 1494990

URL: http://svn.apache.org/r1494990
Log:
Create a new revision of the conflict description structure,
svn_wc_conflict_description3_t. Deprecate svn_wc_conflict_description2_t.

There is some erroneous or improperly defined usage of fields in version 2
of this structure. To clean this up without harming existing API users we
must create a new revision of the structure.

This commit performs mechanical changes only, adding new structs, functions,
and typedef definitions. The new and old structures are still equivalent,
and no caller has been updated to use the new structure. Until further
changes are made, some new deprecation warnings will pop up during builds.

* subversion/include/svn_wc.h
  (svn_wc_conflict_description3_t,
   svn_wc_conflict_description_create_text3,
   svn_wc_conflict_description_create_prop3,
   svn_wc_conflict_description_create_tree3,
   svn_wc__conflict_description3_dup,
   svn_wc_conflict_resolver_func3_t): New.

  (svn_wc_conflict_description2_t,
   svn_wc_conflict_description_create_text2,
   svn_wc_conflict_description_create_prop2,
   svn_wc_conflict_description_create_tree2,
   svn_wc__conflict_description2_dup,
   svn_wc_conflict_resolver_func2_t): New.

* subversion/libsvn_wc/deprecated.c
  (svn_wc_conflict_description_create_text2,
   svn_wc_conflict_description_create_prop2,
   svn_wc_conflict_description_create_tree2,
   svn_wc__conflict_description2_dup): Moved here from libsvn_wc/util.c.

* subversion/libsvn_wc/util.c
  (svn_wc_conflict_description_create_text3,
   svn_wc_conflict_description_create_prop3,
   svn_wc_conflict_description_create_tree3,
   svn_wc__conflict_description3_dup): New, based on version 2 implementations.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_wc/deprecated.c
    subversion/trunk/subversion/libsvn_wc/util.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1494990&r1=1494989&r2=1494990&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Thu Jun 20 13:38:41 2013
@@ -1745,11 +1745,116 @@ svn_wc_conflict_version_dup(const svn_wc
  * @note Fields may be added to the end of this structure in future
  * versions.  Therefore, to preserve binary compatibility, users
  * should not directly allocate structures of this type but should use
+ * svn_wc_conflict_description_create_text3() or
+ * svn_wc_conflict_description_create_prop3() or
+ * svn_wc_conflict_description_create_tree3() instead.
+ *
+ * @since New in 1.9.
+ */
+typedef struct svn_wc_conflict_description3_t
+{
+  /** The path that is in conflict (for a tree conflict, it is the victim) */
+  const char *local_abspath;
+
+  /** The node type of the path being operated on (for a tree conflict,
+   *  ### which version?) */
+  svn_node_kind_t node_kind;
+
+  /** What sort of conflict are we describing? */
+  svn_wc_conflict_kind_t kind;
+
+  /** The name of the property whose conflict is being described.
+   *  (Only if @a kind is 'property'; else undefined.) */
+  const char *property_name;
+
+  /** Whether svn thinks ('my' version of) @c path is a 'binary' file.
+   *  (Only if @c kind is 'text', else undefined.) */
+  svn_boolean_t is_binary;
+
+  /** The svn:mime-type property of ('my' version of) @c path, if available,
+   *  else NULL.
+   *  (Only if @c kind is 'text', else undefined.) */
+  const char *mime_type;
+
+  /** The action being attempted on the conflicted node or property.
+   *  (When @c kind is 'text', this action must be 'edit'.) */
+  svn_wc_conflict_action_t action;
+
+  /** The state of the target node or property, relative to its merge-left
+   *  source, that is the reason for the conflict.
+   *  (When @c kind is 'text', this reason must be 'edited'.) */
+  svn_wc_conflict_reason_t reason;
+
+  /** If this is text-conflict and involves the merging of two files
+   * descended from a common ancestor, here are the paths of up to
+   * four fulltext files that can be used to interactively resolve the
+   * conflict.
+   *
+   * @a base_abspath, @a their_abspath and @a my_abspath are absolute
+   * paths.
+   *
+   * ### Is @a merged_file relative to some directory, or absolute?
+   *
+   * All four files will be in repository-normal form -- LF
+   * line endings and contracted keywords.  (If any of these files are
+   * not available, they default to NULL.)
+   *
+   * On the other hand, if this is a property-conflict, then these
+   * paths represent temporary files that contain the three different
+   * property-values in conflict.  The fourth path (@c merged_file)
+   * may or may not be NULL;  if set, it represents libsvn_wc's
+   * attempt to merge the property values together.  (Remember that
+   * property values are technically binary values, and thus can't
+   * always be merged.)
+   */
+  const char *base_abspath;  /* common ancestor of the two files being merged 
*/
+
+  /** their version of the file */
+  /* ### BH: For properties this field contains the reference to
+             the property rejection (.prej) file */
+  const char *their_abspath;
+
+  /** my locally-edited version of the file */
+  const char *my_abspath;
+
+  /** merged version; may contain conflict markers */
+  const char *merged_file;
+
+  /** The operation that exposed the conflict.
+   * Used only for tree conflicts.
+   */
+  svn_wc_operation_t operation;
+
+  /** Info on the "merge-left source" or "older" version of incoming change. */
+  const svn_wc_conflict_version_t *src_left_version;
+
+  /** Info on the "merge-right source" or "their" version of incoming change. 
*/
+  const svn_wc_conflict_version_t *src_right_version;
+
+  /* Remember to adjust svn_wc__conflict_description3_dup()
+   * if you add new fields to this struct. */
+} svn_wc_conflict_description3_t;
+
+
+/** A struct that describes a conflict that has occurred in the
+ * working copy.
+ *
+ * The conflict described by this structure is one of:
+ *   - a conflict on the content of the file node @a local_abspath
+ *   - a conflict on the property @a property_name of @a local_abspath
+ *   - a tree conflict, of which @a local_abspath is the victim
+ * Be aware that the victim of a tree conflict can be a non-existent node.
+ * The three kinds of conflict are distinguished by @a kind.
+ *
+ * @note Fields may be added to the end of this structure in future
+ * versions.  Therefore, to preserve binary compatibility, users
+ * should not directly allocate structures of this type but should use
  * svn_wc_conflict_description_create_text2() or
  * svn_wc_conflict_description_create_prop2() or
  * svn_wc_conflict_description_create_tree2() instead.
  *
  * @since New in 1.7.
+ * @deprecated Provided for backward compatibility with the 1.8 API.
  */
 typedef struct svn_wc_conflict_description2_t
 {
@@ -1928,7 +2033,7 @@ typedef struct svn_wc_conflict_descripti
 } svn_wc_conflict_description_t;
 
 /**
- * Allocate an #svn_wc_conflict_description_t structure in @a result_pool,
+ * Allocate an #svn_wc_conflict_description3_t structure in @a result_pool,
  * initialize to represent a text conflict, and return it.
  *
  * Set the @c local_abspath field of the created struct to @a local_abspath
@@ -1940,8 +2045,19 @@ typedef struct svn_wc_conflict_descripti
  * @note It is the caller's responsibility to set the other required fields
  * (such as the four file names and @c mime_type and @c is_binary).
  *
+ * @since New in 1.9.
+ */
+svn_wc_conflict_description3_t *
+svn_wc_conflict_description_create_text3(const char *local_abspath,
+                                         apr_pool_t *result_pool);
+
+/* Similar to #svn_wc_conflict_description_create_text3, but returns
+ * an svn_wc_conflict_description2_t *.
+ * 
  * @since New in 1.7.
+ * @deprecated Provided for backward compatibility with the 1.8 API.
  */
+SVN_DEPRECATED
 svn_wc_conflict_description2_t *
 svn_wc_conflict_description_create_text2(const char *local_abspath,
                                          apr_pool_t *result_pool);
@@ -1960,7 +2076,7 @@ svn_wc_conflict_description_create_text(
                                         apr_pool_t *pool);
 
 /**
- * Allocate an #svn_wc_conflict_description_t structure in @a result_pool,
+ * Allocate an #svn_wc_conflict_description3_t structure in @a result_pool,
  * initialize to represent a property conflict, and return it.
  *
  * Set the @c local_abspath field of the created struct to @a local_abspath
@@ -1971,8 +2087,21 @@ svn_wc_conflict_description_create_text(
  * @note: It is the caller's responsibility to set the other required fields
  * (such as the four file names and @c action and @c reason).
  *
+ * @since New in 1.9.
+ */
+svn_wc_conflict_description3_t *
+svn_wc_conflict_description_create_prop3(const char *local_abspath,
+                                         svn_node_kind_t node_kind,
+                                         const char *property_name,
+                                         apr_pool_t *result_pool);
+
+/* Similar to #svn_wc_conflict_description_create_prop3, but returns
+ * an svn_wc_conflict_description2_t *.
+ * 
  * @since New in 1.7.
+ * @deprecated Provided for backward compatibility with the 1.8 API.
  */
+SVN_DEPRECATED
 svn_wc_conflict_description2_t *
 svn_wc_conflict_description_create_prop2(const char *local_abspath,
                                          svn_node_kind_t node_kind,
@@ -2007,8 +2136,24 @@ svn_wc_conflict_description_create_prop(
  * @note: It is the caller's responsibility to set the other required fields
  * (such as the four file names and @c action and @c reason).
  *
+ * @since New in 1.9.
+ */
+svn_wc_conflict_description3_t *
+svn_wc_conflict_description_create_tree3(
+  const char *local_abspath,
+  svn_node_kind_t node_kind,
+  svn_wc_operation_t operation,
+  const svn_wc_conflict_version_t *src_left_version,
+  const svn_wc_conflict_version_t *src_right_version,
+  apr_pool_t *result_pool);
+
+/* Similar to #svn_wc_conflict_description_create_tree3, but returns
+ * an svn_wc_conflict_description2_t *.
+ * 
  * @since New in 1.7.
+ * @deprecated Provided for backward compatibility with the 1.8 API.
  */
+SVN_DEPRECATED
 svn_wc_conflict_description2_t *
 svn_wc_conflict_description_create_tree2(
   const char *local_abspath,
@@ -2040,8 +2185,21 @@ svn_wc_conflict_description_create_tree(
 /** Return a duplicate of @a conflict, allocated in @a result_pool.
  * A deep copy of all members will be made.
  *
+ * @since New in 1.9.
+ */
+svn_wc_conflict_description3_t *
+svn_wc__conflict_description3_dup(
+  const svn_wc_conflict_description3_t *conflict,
+  apr_pool_t *result_pool);
+
+
+/** Like svn_wc__conflict_description3_dup(), but duplicates objects
+ * of type svn_wc_conflict_description2_t.
+ *
  * @since New in 1.7.
+ * @deprecated Provided for backward compatibility with the 1.8 API.
  */
+SVN_DEPRECATED
 svn_wc_conflict_description2_t *
 svn_wc__conflict_description2_dup(
   const svn_wc_conflict_description2_t *conflict,
@@ -2145,7 +2303,21 @@ svn_wc_create_conflict_result(svn_wc_con
  * of conflicts are automatically resolvable and which require user
  * interaction.
  *
+ * @since New in 1.9.
+ */
+typedef svn_error_t *(*svn_wc_conflict_resolver_func3_t)(
+  svn_wc_conflict_result_t **result,
+  const svn_wc_conflict_description3_t *description,
+  void *baton,
+  apr_pool_t *result_pool,
+  apr_pool_t *scratch_pool);
+
+
+/* Similar to #svn_wc_conflict_resolver_func3_t, but expects an
+ * svn_wc_conflict_description2_t description.
+ *
  * @since New in 1.7.
+ * @deprecated Provided for backward compatibility with the 1.8 API.
  */
 typedef svn_error_t *(*svn_wc_conflict_resolver_func2_t)(
   svn_wc_conflict_result_t **result,

Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1494990&r1=1494989&r2=1494990&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Thu Jun 20 13:38:41 2013
@@ -4720,3 +4720,98 @@ svn_wc_read_kind(svn_node_kind_t *kind,
 
   return SVN_NO_ERROR;
 }
+
+svn_wc_conflict_description2_t *
+svn_wc_conflict_description_create_text2(const char *local_abspath,
+                                         apr_pool_t *result_pool)
+{
+  svn_wc_conflict_description2_t *conflict;
+
+  SVN_ERR_ASSERT_NO_RETURN(svn_dirent_is_absolute(local_abspath));
+
+  conflict = apr_pcalloc(result_pool, sizeof(*conflict));
+  conflict->local_abspath = apr_pstrdup(result_pool, local_abspath);
+  conflict->node_kind = svn_node_file;
+  conflict->kind = svn_wc_conflict_kind_text;
+  conflict->action = svn_wc_conflict_action_edit;
+  conflict->reason = svn_wc_conflict_reason_edited;
+  return conflict;
+}
+
+svn_wc_conflict_description2_t *
+svn_wc_conflict_description_create_prop2(const char *local_abspath,
+                                         svn_node_kind_t node_kind,
+                                         const char *property_name,
+                                         apr_pool_t *result_pool)
+{
+  svn_wc_conflict_description2_t *conflict;
+
+  SVN_ERR_ASSERT_NO_RETURN(svn_dirent_is_absolute(local_abspath));
+
+  conflict = apr_pcalloc(result_pool, sizeof(*conflict));
+  conflict->local_abspath = apr_pstrdup(result_pool, local_abspath);
+  conflict->node_kind = node_kind;
+  conflict->kind = svn_wc_conflict_kind_property;
+  conflict->property_name = apr_pstrdup(result_pool, property_name);
+  return conflict;
+}
+
+svn_wc_conflict_description2_t *
+svn_wc_conflict_description_create_tree2(
+  const char *local_abspath,
+  svn_node_kind_t node_kind,
+  svn_wc_operation_t operation,
+  const svn_wc_conflict_version_t *src_left_version,
+  const svn_wc_conflict_version_t *src_right_version,
+  apr_pool_t *result_pool)
+{
+  svn_wc_conflict_description2_t *conflict;
+
+  SVN_ERR_ASSERT_NO_RETURN(svn_dirent_is_absolute(local_abspath));
+
+  conflict = apr_pcalloc(result_pool, sizeof(*conflict));
+  conflict->local_abspath = apr_pstrdup(result_pool, local_abspath);
+  conflict->node_kind = node_kind;
+  conflict->kind = svn_wc_conflict_kind_tree;
+  conflict->operation = operation;
+  conflict->src_left_version = svn_wc_conflict_version_dup(src_left_version,
+                                                           result_pool);
+  conflict->src_right_version = svn_wc_conflict_version_dup(src_right_version,
+                                                            result_pool);
+  return conflict;
+}
+
+svn_wc_conflict_description2_t *
+svn_wc__conflict_description2_dup(const svn_wc_conflict_description2_t 
*conflict,
+                                  apr_pool_t *pool)
+{
+  svn_wc_conflict_description2_t *new_conflict;
+
+  new_conflict = apr_pcalloc(pool, sizeof(*new_conflict));
+
+  /* Shallow copy all members. */
+  *new_conflict = *conflict;
+
+  if (conflict->local_abspath)
+    new_conflict->local_abspath = apr_pstrdup(pool, conflict->local_abspath);
+  if (conflict->property_name)
+    new_conflict->property_name = apr_pstrdup(pool, conflict->property_name);
+  if (conflict->mime_type)
+    new_conflict->mime_type = apr_pstrdup(pool, conflict->mime_type);
+  if (conflict->base_abspath)
+    new_conflict->base_abspath = apr_pstrdup(pool, conflict->base_abspath);
+  if (conflict->their_abspath)
+    new_conflict->their_abspath = apr_pstrdup(pool, conflict->their_abspath);
+  if (conflict->my_abspath)
+    new_conflict->my_abspath = apr_pstrdup(pool, conflict->my_abspath);
+  if (conflict->merged_file)
+    new_conflict->merged_file = apr_pstrdup(pool, conflict->merged_file);
+  if (conflict->src_left_version)
+    new_conflict->src_left_version =
+      svn_wc_conflict_version_dup(conflict->src_left_version, pool);
+  if (conflict->src_right_version)
+    new_conflict->src_right_version =
+      svn_wc_conflict_version_dup(conflict->src_right_version, pool);
+
+  return new_conflict;
+}

Modified: subversion/trunk/subversion/libsvn_wc/util.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/util.c?rev=1494990&r1=1494989&r2=1494990&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/util.c (original)
+++ subversion/trunk/subversion/libsvn_wc/util.c Thu Jun 20 13:38:41 2013
@@ -188,11 +188,11 @@ svn_wc_match_ignore_list(const char *str
   return svn_cstring_match_glob_list(str, list);
 }
 
-svn_wc_conflict_description2_t *
-svn_wc_conflict_description_create_text2(const char *local_abspath,
+svn_wc_conflict_description3_t *
+svn_wc_conflict_description_create_text3(const char *local_abspath,
                                          apr_pool_t *result_pool)
 {
-  svn_wc_conflict_description2_t *conflict;
+  svn_wc_conflict_description3_t *conflict;
 
   SVN_ERR_ASSERT_NO_RETURN(svn_dirent_is_absolute(local_abspath));
 
@@ -205,13 +205,13 @@ svn_wc_conflict_description_create_text2
   return conflict;
 }
 
-svn_wc_conflict_description2_t *
-svn_wc_conflict_description_create_prop2(const char *local_abspath,
+svn_wc_conflict_description3_t *
+svn_wc_conflict_description_create_prop3(const char *local_abspath,
                                          svn_node_kind_t node_kind,
                                          const char *property_name,
                                          apr_pool_t *result_pool)
 {
-  svn_wc_conflict_description2_t *conflict;
+  svn_wc_conflict_description3_t *conflict;
 
   SVN_ERR_ASSERT_NO_RETURN(svn_dirent_is_absolute(local_abspath));
 
@@ -223,8 +223,8 @@ svn_wc_conflict_description_create_prop2
   return conflict;
 }
 
-svn_wc_conflict_description2_t *
-svn_wc_conflict_description_create_tree2(
+svn_wc_conflict_description3_t *
+svn_wc_conflict_description_create_tree3(
   const char *local_abspath,
   svn_node_kind_t node_kind,
   svn_wc_operation_t operation,
@@ -232,7 +232,7 @@ svn_wc_conflict_description_create_tree2
   const svn_wc_conflict_version_t *src_right_version,
   apr_pool_t *result_pool)
 {
-  svn_wc_conflict_description2_t *conflict;
+  svn_wc_conflict_description3_t *conflict;
 
   SVN_ERR_ASSERT_NO_RETURN(svn_dirent_is_absolute(local_abspath));
 
@@ -249,11 +249,11 @@ svn_wc_conflict_description_create_tree2
 }
 
 
-svn_wc_conflict_description2_t *
-svn_wc__conflict_description2_dup(const svn_wc_conflict_description2_t 
*conflict,
+svn_wc_conflict_description3_t *
+svn_wc__conflict_description3_dup(const svn_wc_conflict_description3_t 
*conflict,
                                   apr_pool_t *pool)
 {
-  svn_wc_conflict_description2_t *new_conflict;
+  svn_wc_conflict_description3_t *new_conflict;
 
   new_conflict = apr_pcalloc(pool, sizeof(*new_conflict));
 


Reply via email to