You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/06/25 16:14:45 UTC

svn commit: r1496481 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_wc/conflicts.c libsvn_wc/entries.c libsvn_wc/info.c libsvn_wc/tree_conflicts.c libsvn_wc/util.c libsvn_wc/wc.h

Author: stsp
Date: Tue Jun 25 14:14:44 2013
New Revision: 1496481

URL: http://svn.apache.org/r1496481
Log:
Fix some property conflict inconsistencies in svn_wc_conflict_description3_t.

The property reject file path used to be stored in the 'their_abspath' field.
Use a new 'prop_reject_abspath' field instead. And instead of storing
"their abspath" in the 'merged_file' field, use the 'their_abspath' field.

For now, expose these changes only to callers of svn_wc__read_conflicts().
Show converted svn_wc_conflict_description2_t structures to everyone else.

* subversion/include/svn_wc.h
  (svn_wc_conflict_description3_t): Add prop_reject_abspath.

* subversion/libsvn_wc/conflicts.c
  (resolve_text_conflict,
   svn_wc__conflict_invoke_resolver): Use svn_wc_conflict_description3_t,
    but hide it from the conflict callback for now.
  (read_text_conflict_desc, read_tree_conflict_desc,
   read_prop_conflict_desc): Return svn_wc_conflict_description3_t.
    For prop conflicts, use 'prop_reject_abspath' and 'their_abspath' as above.
  (svn_wc__read_conflicts): Return an array of svn_wc_conflict_description3_t.
  (conflict_status_walker): Adjust this caller of svn_wc__read_conflicts().
   Hide svn_wc_conflict_description3_t from the conflict callback for now.

* subversion/libsvn_wc/entries.c
  (read_one_entry): Adjust this caller of svn_wc__read_conflicts().
   Hide svn_wc_conflict_description3_t from callers.

* subversion/libsvn_wc/info.c
  (build_info_for_node, svn_wc__get_info): Adjust these callers of
    svn_wc__read_conflicts(). Hide svn_wc_conflict_description3_t from callers.

* subversion/libsvn_wc/tree_conflicts.c
  (svn_wc__get_tree_conflict): Adjust this caller of svn_wc__read_conflicts().
   Hide svn_wc_conflict_description3_t from callers.

* subversion/libsvn_wc/util.c
  (svn_wc__cd3_to_cd2): Convert cd3 property conflicts to the cd2 type:
   Map cd3->prop_reject_abspath to cd2->their_abspath,
   and map cd3->their_abspath to cd2->merged_file.

* subversion/libsvn_wc/wc.h
  (svn_wc__read_conflicts): Adjust docstring, this function now returns an
    array with elements of type svn_wc_conflict_description3_t *.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_wc/conflicts.c
    subversion/trunk/subversion/libsvn_wc/entries.c
    subversion/trunk/subversion/libsvn_wc/info.c
    subversion/trunk/subversion/libsvn_wc/tree_conflicts.c
    subversion/trunk/subversion/libsvn_wc/util.c
    subversion/trunk/subversion/libsvn_wc/wc.h

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1496481&r1=1496480&r2=1496481&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Tue Jun 25 14:14:44 2013
@@ -1810,8 +1810,6 @@ typedef struct svn_wc_conflict_descripti
   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 */
@@ -1820,6 +1818,9 @@ typedef struct svn_wc_conflict_descripti
   /** merged version; may contain conflict markers */
   const char *merged_file;
 
+  /* For property conflicts, the path to the property reject file. */
+  const char *prop_reject_abspath;
+
   /** The operation that exposed the conflict.
    * Used only for tree conflicts.
    */

Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=1496481&r1=1496480&r2=1496481&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Tue Jun 25 14:14:44 2013
@@ -1781,7 +1781,7 @@ resolve_text_conflict(svn_skel_t **work_
                       svn_boolean_t *was_resolved,
                       svn_wc__db_t *db,
                       const char *local_abspath,
-                      svn_wc_conflict_description2_t *cdesc,
+                      svn_wc_conflict_description3_t *cdesc,
                       const apr_array_header_t *merge_options,
                       svn_wc_conflict_resolver_func2_t conflict_func,
                       void *conflict_baton,
@@ -1797,8 +1797,8 @@ resolve_text_conflict(svn_skel_t **work_
   /* Give the conflict resolution callback a chance to clean
      up the conflicts before we mark the file 'conflicted' */
 
-  SVN_ERR(conflict_func(&result, cdesc, conflict_baton, scratch_pool,
-                        scratch_pool));
+  SVN_ERR(conflict_func(&result, svn_wc__cd3_to_cd2(cdesc, scratch_pool),
+                        conflict_baton, scratch_pool, scratch_pool));
   if (result == NULL)
     return svn_error_create(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
                             _("Conflict callback violated API:"
@@ -1851,7 +1851,7 @@ resolve_text_conflict(svn_skel_t **work_
  * Allocate results in RESULT_POOL.  SCRATCH_POOL is used for temporary
  * allocations. */
 static svn_error_t *
-read_text_conflict_desc(svn_wc_conflict_description2_t **desc,
+read_text_conflict_desc(svn_wc_conflict_description3_t **desc,
                         svn_wc__db_t *db,
                         const char *local_abspath,
                         const svn_skel_t *conflict_skel,
@@ -1863,7 +1863,7 @@ read_text_conflict_desc(svn_wc_conflict_
                         apr_pool_t *result_pool,
                         apr_pool_t *scratch_pool)
 {
-  *desc = svn_wc_conflict_description_create_text2(local_abspath, result_pool);
+  *desc = svn_wc_conflict_description_create_text3(local_abspath, result_pool);
   (*desc)->is_binary = is_binary;
   (*desc)->mime_type = mime_type;
   (*desc)->operation = operation;
@@ -1891,7 +1891,7 @@ read_text_conflict_desc(svn_wc_conflict_
  * Allocate results in RESULT_POOL.  SCRATCH_POOL is used for temporary
  * allocations. */
 static svn_error_t *
-read_tree_conflict_desc(svn_wc_conflict_description2_t **desc,
+read_tree_conflict_desc(svn_wc_conflict_description3_t **desc,
                         svn_wc__db_t *db,
                         const char *local_abspath,
                         const svn_skel_t *conflict_skel,
@@ -1916,7 +1916,7 @@ read_tree_conflict_desc(svn_wc_conflict_
   else
     tc_kind = svn_node_file; /* Avoid assertion */
 
-  *desc = svn_wc_conflict_description_create_tree2(local_abspath, tc_kind,
+  *desc = svn_wc_conflict_description_create_tree3(local_abspath, tc_kind,
                                                    operation,
                                                    left_version, right_version,
                                                    result_pool);
@@ -2042,7 +2042,7 @@ svn_wc__conflict_invoke_resolver(svn_wc_
     {
       svn_skel_t *work_items;
       svn_boolean_t was_resolved;
-      svn_wc_conflict_description2_t *desc;
+      svn_wc_conflict_description3_t *desc;
       apr_hash_t *props;
 
       SVN_ERR(svn_wc__db_read_props(&props, db, local_abspath,
@@ -2079,7 +2079,7 @@ svn_wc__conflict_invoke_resolver(svn_wc_
   if (tree_conflicted)
     {
       svn_wc_conflict_result_t *result;
-      svn_wc_conflict_description2_t *desc;
+      svn_wc_conflict_description3_t *desc;
 
       SVN_ERR(read_tree_conflict_desc(&desc,
                                       db, local_abspath, conflict_skel,
@@ -2087,8 +2087,8 @@ svn_wc__conflict_invoke_resolver(svn_wc_
                                       scratch_pool, scratch_pool));
 
       /* Tell the resolver func about this conflict. */
-      SVN_ERR(resolver_func(&result, desc, resolver_baton, scratch_pool,
-                            scratch_pool));
+      SVN_ERR(resolver_func(&result, svn_wc__cd3_to_cd2(desc, scratch_pool),
+                            resolver_baton, scratch_pool, scratch_pool));
 
       /* Ignore the result. We cannot apply it here since this code runs
        * during an update or merge operation. Tree conflicts are always
@@ -2144,22 +2144,19 @@ read_prop_conflict_descs(apr_array_heade
   if ((! create_tempfiles) || apr_hash_count(conflicted_props) == 0)
     {
       /* Legacy prop conflict with only a .reject file. */
-      svn_wc_conflict_description2_t *desc;
+      svn_wc_conflict_description3_t *desc;
 
-      desc  = svn_wc_conflict_description_create_prop2(local_abspath,
+      desc  = svn_wc_conflict_description_create_prop3(local_abspath,
                                                        node_kind,
                                                        "", result_pool);
 
-      /* ### This should be changed. The prej file should be stored
-       * ### separately from the other files. We need to rev the
-       * ### conflict description struct for this. */
-      desc->their_abspath = apr_pstrdup(result_pool, prop_reject_file);
+      desc->prop_reject_abspath = apr_pstrdup(result_pool, prop_reject_file);
 
       desc->operation = operation;
       desc->src_left_version = left_version;
       desc->src_right_version = right_version;
 
-      APR_ARRAY_PUSH(conflicts, svn_wc_conflict_description2_t*) = desc;
+      APR_ARRAY_PUSH(conflicts, svn_wc_conflict_description3_t*) = desc;
 
       return SVN_NO_ERROR;
     }
@@ -2173,14 +2170,14 @@ read_prop_conflict_descs(apr_array_heade
       svn_string_t *old_value;
       svn_string_t *my_value;
       svn_string_t *their_value;
-      svn_wc_conflict_description2_t *desc;
+      svn_wc_conflict_description3_t *desc;
 
       svn_pool_clear(iterpool);
 
-      desc  = svn_wc_conflict_description_create_prop2(local_abspath,
-                                                       node_kind,
-                                                       propname,
-                                                       result_pool);
+      desc = svn_wc_conflict_description_create_prop3(local_abspath,
+                                                      node_kind,
+                                                      propname,
+                                                      result_pool);
 
       desc->operation = operation;
       desc->src_left_version = left_version;
@@ -2208,10 +2205,7 @@ read_prop_conflict_descs(apr_array_heade
       else
         desc->reason = svn_wc_conflict_reason_edited;
 
-      /* ### This should be changed. The prej file should be stored
-       * ### separately from the other files. We need to rev the
-       * ### conflict description struct for this. */
-      desc->their_abspath = apr_pstrdup(result_pool, prop_reject_file);
+      desc->prop_reject_abspath = apr_pstrdup(result_pool, prop_reject_file);
 
       /* ### This should be changed. The conflict description for
        * ### props should contain these values as svn_string_t,
@@ -2235,10 +2229,7 @@ read_prop_conflict_descs(apr_array_heade
           svn_stream_t *s;
           apr_size_t len;
 
-          /* ### Currently, their_abspath is used for the prop reject file.
-           * ### Put their value into merged instead...
-           * ### We need to rev the conflict description struct to fix this. */
-          SVN_ERR(svn_stream_open_unique(&s, &desc->merged_file, NULL,
+          SVN_ERR(svn_stream_open_unique(&s, &desc->their_abspath, NULL,
                                          svn_io_file_del_on_pool_cleanup,
                                          result_pool, iterpool));
           len = their_value->len;
@@ -2259,7 +2250,7 @@ read_prop_conflict_descs(apr_array_heade
           SVN_ERR(svn_stream_close(s));
         }
 
-      APR_ARRAY_PUSH(conflicts, svn_wc_conflict_description2_t*) = desc;
+      APR_ARRAY_PUSH(conflicts, svn_wc_conflict_description3_t*) = desc;
     }
   svn_pool_destroy(iterpool);
 
@@ -2301,7 +2292,7 @@ svn_wc__read_conflicts(const apr_array_h
                                      result_pool, scratch_pool));
 
   cflcts = apr_array_make(result_pool, 4,
-                          sizeof(svn_wc_conflict_description2_t*));
+                          sizeof(svn_wc_conflict_description3_t*));
 
   if (locations && locations->nelts > 0)
     left_version = APR_ARRAY_IDX(locations, 0, const svn_wc_conflict_version_t *);
@@ -2322,26 +2313,26 @@ svn_wc__read_conflicts(const apr_array_h
 
   if (text_conflicted)
     {
-      svn_wc_conflict_description2_t *desc;
+      svn_wc_conflict_description3_t *desc;
 
       SVN_ERR(read_text_conflict_desc(&desc,
                                       db, local_abspath, conflict_skel,
                                       FALSE /*is_binary*/, NULL /*mime_type*/,
                                       operation, left_version, right_version,
                                       result_pool, scratch_pool));
-      APR_ARRAY_PUSH(cflcts, svn_wc_conflict_description2_t*) = desc;
+      APR_ARRAY_PUSH(cflcts, svn_wc_conflict_description3_t*) = desc;
     }
 
   if (tree_conflicted)
     {
-      svn_wc_conflict_description2_t *desc;
+      svn_wc_conflict_description3_t *desc;
 
       SVN_ERR(read_tree_conflict_desc(&desc,
                                       db, local_abspath, conflict_skel,
                                       operation, left_version, right_version,
                                       result_pool, scratch_pool));
 
-      APR_ARRAY_PUSH(cflcts, const svn_wc_conflict_description2_t *) = desc;
+      APR_ARRAY_PUSH(cflcts, const svn_wc_conflict_description3_t *) = desc;
     }
 
   *conflicts = cflcts;
@@ -2929,12 +2920,12 @@ conflict_status_walker(void *baton,
 
   for (i = 0; i < conflicts->nelts; i++)
     {
-      const svn_wc_conflict_description2_t *cd;
+      const svn_wc_conflict_description3_t *cd;
       svn_boolean_t did_resolve;
       svn_wc_conflict_choice_t my_choice = cswb->conflict_choice;
       const char *merged_file = NULL;
 
-      cd = APR_ARRAY_IDX(conflicts, i, const svn_wc_conflict_description2_t *);
+      cd = APR_ARRAY_IDX(conflicts, i, const svn_wc_conflict_description3_t *);
 
       svn_pool_clear(iterpool);
 
@@ -2947,7 +2938,9 @@ conflict_status_walker(void *baton,
                                     _("No conflict-callback and no "
                                       "pre-defined conflict-choice provided"));
 
-          SVN_ERR(cswb->conflict_func(&result, cd, cswb->conflict_baton,
+          SVN_ERR(cswb->conflict_func(&result,
+                                      svn_wc__cd3_to_cd2(cd, scratch_pool),
+                                      cswb->conflict_baton,
                                       iterpool, iterpool));
 
           my_choice = result->choice;

Modified: subversion/trunk/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entries.c?rev=1496481&r1=1496480&r2=1496481&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/entries.c (original)
+++ subversion/trunk/subversion/libsvn_wc/entries.c Tue Jun 25 14:14:44 2013
@@ -464,15 +464,16 @@ read_one_entry(const svn_wc_entry_t **ne
 
           for (j = 0; j < child_conflicts->nelts; j++)
             {
-              const svn_wc_conflict_description2_t *conflict =
+              const svn_wc_conflict_description3_t *conflict =
                 APR_ARRAY_IDX(child_conflicts, j,
-                              svn_wc_conflict_description2_t *);
+                              svn_wc_conflict_description3_t *);
 
               if (conflict->kind == svn_wc_conflict_kind_tree)
                 {
                   if (!tree_conflicts)
                     tree_conflicts = apr_hash_make(scratch_pool);
-                  svn_hash_sets(tree_conflicts, child_name, conflict);
+                  svn_hash_sets(tree_conflicts, child_name,
+                                svn_wc__cd3_to_cd2(conflict, scratch_pool));
                 }
             }
         }

Modified: subversion/trunk/subversion/libsvn_wc/info.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/info.c?rev=1496481&r1=1496480&r2=1496481&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/info.c (original)
+++ subversion/trunk/subversion/libsvn_wc/info.c Tue Jun 25 14:14:44 2013
@@ -310,10 +310,16 @@ build_info_for_node(svn_wc__info2_t **in
                                 local_abspath, result_pool, scratch_pool));
 
   if (conflicted)
-    SVN_ERR(svn_wc__read_conflicts(&wc_info->conflicts, db,
-                                   local_abspath,
-                                   TRUE /* ### create tempfiles */,
-                                   result_pool, scratch_pool));
+    {
+      const apr_array_header_t *conflicts;
+
+      SVN_ERR(svn_wc__read_conflicts(&conflicts, db,
+                                     local_abspath,
+                                     TRUE /* ### create tempfiles */,
+                                     result_pool, scratch_pool));
+      wc_info->conflicts = svn_wc__cd3_array_to_cd2_array(conflicts,
+                                                          result_pool);
+    }
   else
     wc_info->conflicts = NULL;
 
@@ -534,8 +540,9 @@ svn_wc__get_info(svn_wc_context_t *wc_ct
        hi = apr_hash_next(hi))
     {
       const char *this_abspath = svn__apr_hash_index_key(hi);
-      const svn_wc_conflict_description2_t *tree_conflict;
+      const svn_wc_conflict_description3_t *tree_conflict;
       svn_wc__info2_t *info;
+      const apr_array_header_t *conflicts;
 
       svn_pool_clear(iterpool);
 
@@ -557,21 +564,22 @@ svn_wc__get_info(svn_wc_context_t *wc_ct
       info->repos_root_URL = repos_root_url;
       info->repos_UUID = repos_uuid;
 
-      SVN_ERR(svn_wc__read_conflicts(&info->wc_info->conflicts,
+      SVN_ERR(svn_wc__read_conflicts(&conflicts,
                                      wc_ctx->db, this_abspath,
                                      TRUE /* ### create tempfiles */,
                                      iterpool, iterpool));
-
-      if (! info->wc_info->conflicts || ! info->wc_info->conflicts->nelts)
+      if (! conflicts || ! conflicts->nelts)
         continue;
 
-      tree_conflict = APR_ARRAY_IDX(info->wc_info->conflicts, 0,
-                                    svn_wc_conflict_description2_t *);
+      tree_conflict = APR_ARRAY_IDX(conflicts, 0,
+                                    const svn_wc_conflict_description3_t *);
 
       if (!depth_includes(local_abspath, depth, tree_conflict->local_abspath,
                           tree_conflict->node_kind, iterpool))
         continue;
 
+      info->wc_info->conflicts = svn_wc__cd3_array_to_cd2_array(conflicts,
+                                                                iterpool);
       SVN_ERR(receiver(receiver_baton, this_abspath, info, iterpool));
     }
   svn_pool_destroy(iterpool);

Modified: subversion/trunk/subversion/libsvn_wc/tree_conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/tree_conflicts.c?rev=1496481&r1=1496480&r2=1496481&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/tree_conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/tree_conflicts.c Tue Jun 25 14:14:44 2013
@@ -495,14 +495,13 @@ svn_wc__get_tree_conflict(const svn_wc_c
 
   for (i = 0; i < conflicts->nelts; i++)
     {
-      const svn_wc_conflict_description2_t *desc;
+      const svn_wc_conflict_description3_t *desc;
 
-      desc = APR_ARRAY_IDX(conflicts, i, svn_wc_conflict_description2_t *);
+      desc = APR_ARRAY_IDX(conflicts, i, svn_wc_conflict_description3_t *);
 
       if (desc->kind == svn_wc_conflict_kind_tree)
         {
-          *tree_conflict = svn_wc__conflict_description2_dup(desc,
-                                                             result_pool);
+          *tree_conflict = svn_wc__cd3_to_cd2(desc, result_pool);
           return SVN_NO_ERROR;
         }
     }

Modified: subversion/trunk/subversion/libsvn_wc/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/util.c?rev=1496481&r1=1496480&r2=1496481&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/util.c (original)
+++ subversion/trunk/subversion/libsvn_wc/util.c Tue Jun 25 14:14:44 2013
@@ -389,13 +389,30 @@ svn_wc__cd3_to_cd2(const svn_wc_conflict
   if (conflict->base_abspath)
     new_conflict->base_abspath = apr_pstrdup(result_pool,
                                              conflict->base_abspath);
-  if (conflict->their_abspath)
-    new_conflict->their_abspath = apr_pstrdup(result_pool,
-                                              conflict->their_abspath);
+
+  if (conflict->kind == svn_wc_conflict_kind_property)
+    {
+      /* For property conflicts, cd2 stored prop_reject_abspath in
+       * their_abspath, and stored theirs_abspath in merged_file. */
+      if (conflict->prop_reject_abspath)
+        new_conflict->their_abspath = apr_pstrdup(result_pool,
+                                                  conflict->prop_reject_abspath);
+      if (conflict->their_abspath)
+        new_conflict->merged_file = apr_pstrdup(result_pool,
+                                                conflict->their_abspath);
+    }
+  else
+    {
+      if (conflict->their_abspath)
+        new_conflict->their_abspath = apr_pstrdup(result_pool,
+                                                  conflict->their_abspath);
+
+      if (conflict->merged_file)
+        new_conflict->merged_file = apr_pstrdup(result_pool,
+                                                conflict->merged_file);
+    }
   if (conflict->my_abspath)
     new_conflict->my_abspath = apr_pstrdup(result_pool, conflict->my_abspath);
-  if (conflict->merged_file)
-    new_conflict->merged_file = apr_pstrdup(result_pool, conflict->merged_file);
   new_conflict->operation = conflict->operation;
   if (conflict->src_left_version)
     new_conflict->src_left_version =

Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=1496481&r1=1496480&r2=1496481&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Tue Jun 25 14:14:44 2013
@@ -681,7 +681,7 @@ svn_wc__write_check(svn_wc__db_t *db,
                     const char *local_abspath,
                     apr_pool_t *scratch_pool);
 
-/* Read into CONFLICTS svn_wc_conflict_description2_t* structs
+/* Read into CONFLICTS svn_wc_conflict_description3_t* structs
  * for all conflicts that have LOCAL_ABSPATH as victim.
  *
  * Victim must be versioned or be part of a tree conflict.