subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From v...@apache.org
Subject svn commit: r1425414 [3/5] - in /subversion/branches/javahl-ra: ./ notes/wc-ng/ subversion/bindings/javahl/tests/org/apache/subversion/javahl/ subversion/bindings/javahl/tests/org/tigris/subversion/javahl/ subversion/include/ subversion/libsvn_subr/ su...
Date Sun, 23 Dec 2012 05:58:53 GMT
Modified: subversion/branches/javahl-ra/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_wc/props.c?rev=1425414&r1=1425413&r2=1425414&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_wc/props.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_wc/props.c Sun Dec 23 05:58:52 2012
@@ -237,7 +237,8 @@ svn_wc__perform_props_merge(svn_wc_notif
   apr_hash_t *new_actual_props;
   svn_boolean_t had_props, props_mod;
   svn_boolean_t have_base;
-  svn_skel_t *work_items;
+  svn_skel_t *work_items = NULL;
+  svn_skel_t *conflict_skel = NULL;
 
   /* IMPORTANT: svn_wc_merge_prop_diffs relies on the fact that baseprops
      may be NULL. */
@@ -299,24 +300,38 @@ svn_wc__perform_props_merge(svn_wc_notif
 
   /* Note that while this routine does the "real" work, it's only
      prepping tempfiles and writing log commands.  */
-  SVN_ERR(svn_wc__merge_props(&work_items, state,
+  SVN_ERR(svn_wc__merge_props(&conflict_skel, state,
                               &new_pristine_props, &new_actual_props,
                               db, local_abspath, kind,
-                              left_version, right_version,
                               baseprops /* server_baseprops */,
                               pristine_props,
                               actual_props,
                               propchanges, base_merge, dry_run,
-                              conflict_func, conflict_baton,
                               cancel_func, cancel_baton,
                               scratch_pool, scratch_pool));
 
   if (dry_run)
     {
-      SVN_ERR_ASSERT(! work_items);
       return SVN_NO_ERROR;
     }
 
+  if (conflict_skel)
+    {
+      svn_skel_t *work_item;
+      SVN_ERR(svn_wc__conflict_skel_set_op_merge(conflict_skel,
+                                                 left_version,
+                                                 right_version,
+                                                 scratch_pool,
+                                                 scratch_pool));
+
+      SVN_ERR(svn_wc__conflict_create_markers(&work_item,
+                                              db, local_abspath,
+                                              conflict_skel,
+                                              scratch_pool, scratch_pool));
+
+      work_items = svn_wc__wq_merge(work_items, work_item, scratch_pool);
+    }
+
   {
     const char *dir_abspath;
 
@@ -344,9 +359,10 @@ svn_wc__perform_props_merge(svn_wc_notif
       return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
                               U_("base_merge=TRUE is no longer supported"));
 #endif
+
     SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, new_actual_props,
                                     svn_wc__has_magic_property(propchanges),
-                                    NULL /* conflict */,
+                                    conflict_skel,
                                     work_items,
                                     scratch_pool));
 
@@ -355,6 +371,12 @@ svn_wc__perform_props_merge(svn_wc_notif
                              scratch_pool));
   }
 
+  if (conflict_skel && conflict_func)
+    SVN_ERR(svn_wc__conflict_invoke_resolver(db, local_abspath, conflict_skel,
+                                             NULL /* merge_options */,
+                                             conflict_func, conflict_baton,
+                                             scratch_pool));
+
   return SVN_NO_ERROR;
 }
 
@@ -769,268 +791,6 @@ set_prop_merge_state(svn_wc_notify_state
   *state = new_value;
 }
 
-/* Helper function for the three apply_* functions below, used when
- * merging properties together.
- *
- * Given property PROPNAME on LOCAL_ABSPATH, and four possible property
- * values, generate four tmpfiles and pass them to CONFLICT_FUNC callback.
- * This gives the client an opportunity to interactively resolve the
- * property conflict.
- *
- * BASE_VAL/WORKING_VAL represent the current state of the working
- * copy, and INCOMING_OLD_VAL/INCOMING_NEW_VAL represents the incoming
- * propchange.  Any of these values might be NULL, indicating either
- * non-existence or intent-to-delete.
- *
- * If the callback isn't available, or if it responds with
- * 'choose_postpone', then set *CONFLICT_REMAINS to TRUE and return.
- *
- * If the callback responds with a choice of 'base', 'theirs', 'mine',
- * or 'merged', then install the proper value into ACTUAL_PROPS and
- * set *CONFLICT_REMAINS to FALSE.
- */
-static svn_error_t *
-maybe_generate_propconflict(svn_boolean_t *conflict_remains,
-                            svn_wc__db_t *db,
-                            const char *local_abspath,
-                            const svn_wc_conflict_version_t *left_version,
-                            const svn_wc_conflict_version_t *right_version,
-                            svn_boolean_t is_dir,
-                            const char *propname,
-                            apr_hash_t *actual_props,
-                            const svn_string_t *incoming_old_val,
-                            const svn_string_t *incoming_new_val,
-                            const svn_string_t *base_val,
-                            const svn_string_t *working_val,
-                            svn_wc_conflict_resolver_func2_t conflict_func,
-                            void *conflict_baton,
-                            svn_boolean_t dry_run,
-                            apr_pool_t *scratch_pool)
-{
-  svn_wc_conflict_result_t *result = NULL;
-  apr_pool_t *filepool = svn_pool_create(scratch_pool);
-  svn_wc_conflict_description2_t *cdesc;
-  const char *dirpath = svn_dirent_dirname(local_abspath, filepool);
-
-  if (! conflict_func || dry_run)
-    {
-      /* Just postpone the conflict. */
-      *conflict_remains = TRUE;
-      return SVN_NO_ERROR;
-    }
-
-  cdesc = svn_wc_conflict_description_create_prop2(
-    local_abspath,
-    is_dir ? svn_node_dir : svn_node_file, propname, scratch_pool);
-
-  cdesc->src_left_version = left_version;
-  cdesc->src_right_version = right_version;
-
-  /* Create a tmpfile for each of the string_t's we've got.  */
-  if (working_val)
-    {
-      const char *file_name;
-
-      SVN_ERR(svn_io_write_unique(&file_name, dirpath, working_val->data,
-                                  working_val->len,
-                                  svn_io_file_del_on_pool_cleanup, filepool));
-      cdesc->my_abspath = svn_dirent_join(dirpath, file_name, filepool);
-    }
-
-  if (incoming_new_val)
-    {
-      const char *file_name;
-
-      SVN_ERR(svn_io_write_unique(&file_name, dirpath, incoming_new_val->data,
-                                  incoming_new_val->len,
-                                  svn_io_file_del_on_pool_cleanup, filepool));
-      cdesc->their_abspath = svn_dirent_join(dirpath, file_name, filepool);
-    }
-
-  if (!base_val && !incoming_old_val)
-    {
-      /* If base and old are both NULL, then that's fine, we just let
-         base_file stay NULL as-is.  Both agents are attempting to add a
-         new property.  */
-    }
-
-  else if ((base_val && !incoming_old_val)
-           || (!base_val && incoming_old_val))
-    {
-      /* If only one of base and old are defined, then we've got a
-         situation where one agent is attempting to add the property
-         for the first time, and the other agent is changing a
-         property it thinks already exists.  In this case, we return
-         whichever older-value happens to be defined, so that the
-         conflict-callback can still attempt a 3-way merge. */
-
-      const svn_string_t *conflict_base_val = base_val ? base_val
-                                                       : incoming_old_val;
-      const char *file_name;
-
-      SVN_ERR(svn_io_write_unique(&file_name, dirpath,
-                                  conflict_base_val->data,
-                                  conflict_base_val->len,
-                                  svn_io_file_del_on_pool_cleanup,
-                                  filepool));
-      cdesc->base_abspath = svn_dirent_join(dirpath, file_name, filepool);
-    }
-
-  else  /* base and old are both non-NULL */
-    {
-      const svn_string_t *conflict_base_val;
-      const char *file_name;
-
-      if (! svn_string_compare(base_val, incoming_old_val))
-        {
-          /* What happens if 'base' and 'old' don't match up?  In an
-             ideal situation, they would.  But if they don't, this is
-             a classic example of a patch 'hunk' failing to apply due
-             to a lack of context.  For example: imagine that the user
-             is busy changing the property from a value of "cat" to
-             "dog", but the incoming propchange wants to change the
-             same property value from "red" to "green".  Total context
-             mismatch.
-
-             HOWEVER: we can still pass one of the two base values as
-             'base_file' to the callback anyway.  It's still useful to
-             present the working and new values to the user to
-             compare. */
-
-          if (working_val && svn_string_compare(base_val, working_val))
-            conflict_base_val = incoming_old_val;
-          else
-            conflict_base_val = base_val;
-        }
-      else
-        {
-          conflict_base_val = base_val;
-        }
-
-      SVN_ERR(svn_io_write_unique(&file_name, dirpath, conflict_base_val->data,
-                                  conflict_base_val->len,
-                                  svn_io_file_del_on_pool_cleanup, filepool));
-      cdesc->base_abspath = svn_dirent_join(dirpath, file_name, filepool);
-
-      if (working_val && incoming_new_val)
-        {
-          svn_stream_t *mergestream;
-          svn_diff_t *diff;
-          svn_diff_file_options_t *options =
-            svn_diff_file_options_create(filepool);
-
-          SVN_ERR(svn_stream_open_unique(&mergestream, &cdesc->merged_file,
-                                         NULL, svn_io_file_del_on_pool_cleanup,
-                                         filepool, scratch_pool));
-          SVN_ERR(svn_diff_mem_string_diff3(&diff, conflict_base_val,
-                                            working_val,
-                                            incoming_new_val, options, filepool));
-          SVN_ERR(svn_diff_mem_string_output_merge2
-                  (mergestream, diff, conflict_base_val, working_val,
-                   incoming_new_val, NULL, NULL, NULL, NULL,
-                   svn_diff_conflict_display_modified_latest, filepool));
-          SVN_ERR(svn_stream_close(mergestream));
-        }
-    }
-
-  /* Build the rest of the description object: */
-  cdesc->mime_type = (is_dir ? NULL : svn_prop_get_value(actual_props,
-                                                         SVN_PROP_MIME_TYPE));
-  cdesc->is_binary = (cdesc->mime_type
-                      && svn_mime_type_is_binary(cdesc->mime_type));
-
-  if (!incoming_old_val && incoming_new_val)
-    cdesc->action = svn_wc_conflict_action_add;
-  else if (incoming_old_val && !incoming_new_val)
-    cdesc->action = svn_wc_conflict_action_delete;
-  else
-    cdesc->action = svn_wc_conflict_action_edit;
-
-  if (base_val && !working_val)
-    cdesc->reason = svn_wc_conflict_reason_deleted;
-  else if (!base_val && working_val)
-    cdesc->reason = svn_wc_conflict_reason_obstructed;
-  else
-    cdesc->reason = svn_wc_conflict_reason_edited;
-
-  /* Invoke the interactive conflict callback. */
-  {
-    SVN_ERR(conflict_func(&result, cdesc, conflict_baton, scratch_pool,
-                          scratch_pool));
-  }
-  if (result == NULL)
-    {
-      *conflict_remains = TRUE;
-      return svn_error_create(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE,
-                              NULL, _("Conflict callback violated API:"
-                                      " returned no results."));
-    }
-
-  switch (result->choice)
-    {
-      default:
-      case svn_wc_conflict_choose_postpone:
-        {
-          *conflict_remains = TRUE;
-          break;
-        }
-      case svn_wc_conflict_choose_mine_full:
-        {
-          /* No need to change actual_props; it already contains working_val */
-          *conflict_remains = FALSE;
-          break;
-        }
-      /* I think _mine_full and _theirs_full are appropriate for prop
-         behavior as well as the text behavior.  There should even be
-         analogous behaviors for _mine and _theirs when those are
-         ready, namely: fold in all non-conflicting prop changes, and
-         then choose _mine side or _theirs side for conflicting ones. */
-      case svn_wc_conflict_choose_theirs_full:
-        {
-          apr_hash_set(actual_props, propname, APR_HASH_KEY_STRING,
-                       incoming_new_val);
-          *conflict_remains = FALSE;
-          break;
-        }
-      case svn_wc_conflict_choose_base:
-        {
-          apr_hash_set(actual_props, propname, APR_HASH_KEY_STRING, base_val);
-          *conflict_remains = FALSE;
-          break;
-        }
-      case svn_wc_conflict_choose_merged:
-        {
-          if (!cdesc->merged_file && !result->merged_file)
-            return svn_error_create
-                (SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE,
-                 NULL, _("Conflict callback violated API:"
-                         " returned no merged file."));
-          else
-            {
-              svn_stringbuf_t *merged_stringbuf;
-              svn_string_t *merged_string;
-
-              SVN_ERR(svn_stringbuf_from_file2(&merged_stringbuf,
-                                               result->merged_file ?
-                                                    result->merged_file :
-                                                    cdesc->merged_file,
-                                               scratch_pool));
-              merged_string = svn_stringbuf__morph_into_string(merged_stringbuf);
-              apr_hash_set(actual_props, propname,
-                           APR_HASH_KEY_STRING, merged_string);
-              *conflict_remains = FALSE;
-            }
-          break;
-        }
-    }
-
-  /* Delete any tmpfiles we made. */
-  svn_pool_destroy(filepool);
-
-  return SVN_NO_ERROR;
-}
-
-
 /* Add the property with name PROPNAME to the set of ACTUAL_PROPS on
  * PATH, setting *STATE or *CONFLICT_REMAINS according to merge outcomes.
  *
@@ -1040,26 +800,16 @@ maybe_generate_propconflict(svn_boolean_
  * BASE_VAL contains the working copy base property value
  *
  * NEW_VAL contains the value to be set.
- *
- * CONFLICT_FUNC/BATON is a callback to be called before declaring a
- * property conflict;  it gives the client a chance to resolve the
- * conflict interactively.
  */
 static svn_error_t *
 apply_single_prop_add(svn_wc_notify_state_t *state,
                       svn_boolean_t *conflict_remains,
                       svn_wc__db_t *db,
                       const char *local_abspath,
-                      const svn_wc_conflict_version_t *left_version,
-                      const svn_wc_conflict_version_t *right_version,
-                      svn_boolean_t is_dir,
                       apr_hash_t *actual_props,
                       const char *propname,
                       const svn_string_t *base_val,
                       const svn_string_t *new_val,
-                      svn_wc_conflict_resolver_func2_t conflict_func,
-                      void *conflict_baton,
-                      svn_boolean_t dry_run,
                       apr_pool_t *result_pool,
                       apr_pool_t *scratch_pool)
 
@@ -1112,31 +862,11 @@ apply_single_prop_add(svn_wc_notify_stat
             }
 
           if (!merged_prop)
-            {
-              SVN_ERR(maybe_generate_propconflict(conflict_remains,
-                                                  db, local_abspath,
-                                                  left_version, right_version,
-                                                  is_dir,
-                                                  propname, actual_props,
-                                                  NULL, new_val,
-                                                  base_val, working_val,
-                                                  conflict_func,
-                                                  conflict_baton,
-                                                  dry_run, scratch_pool));
-            }
+            *conflict_remains = TRUE;
         }
     }
   else if (base_val)
-    {
-      SVN_ERR(maybe_generate_propconflict(conflict_remains,
-                                          db, local_abspath,
-                                          left_version, right_version,
-                                          is_dir, propname,
-                                          actual_props, NULL, new_val,
-                                          base_val, NULL,
-                                          conflict_func, conflict_baton,
-                                          dry_run, scratch_pool));
-    }
+    *conflict_remains = TRUE;
   else  /* property doesn't yet exist in actual_props...  */
     /* so just set it */
     apr_hash_set(actual_props, propname, APR_HASH_KEY_STRING, new_val);
@@ -1156,26 +886,16 @@ apply_single_prop_add(svn_wc_notify_stat
  *
  * OLD_VAL contains the value the of the property the server
  * thinks it's deleting.
- *
- * CONFLICT_FUNC/BATON is a callback to be called before declaring a
- * property conflict;  it gives the client a chance to resolve the
- * conflict interactively.
  */
 static svn_error_t *
 apply_single_prop_delete(svn_wc_notify_state_t *state,
                          svn_boolean_t *conflict_remains,
                          svn_wc__db_t *db,
                          const char *local_abspath,
-                         const svn_wc_conflict_version_t *left_version,
-                         const svn_wc_conflict_version_t *right_version,
-                         svn_boolean_t is_dir,
                          apr_hash_t *actual_props,
                          const char *propname,
                          const svn_string_t *base_val,
                          const svn_string_t *old_val,
-                         svn_wc_conflict_resolver_func2_t conflict_func,
-                         void *conflict_baton,
-                         svn_boolean_t dry_run,
                          apr_pool_t *result_pool,
                          apr_pool_t *scratch_pool)
 {
@@ -1190,14 +910,7 @@ apply_single_prop_delete(svn_wc_notify_s
           && !svn_string_compare(working_val, old_val))
         {
           /* We are trying to delete a locally-added prop. */
-          SVN_ERR(maybe_generate_propconflict(conflict_remains,
-                                              db, local_abspath,
-                                              left_version, right_version,
-                                              is_dir, propname,
-                                              actual_props, old_val, NULL,
-                                              base_val, working_val,
-                                              conflict_func, conflict_baton,
-                                              dry_run, scratch_pool));
+          *conflict_remains = TRUE;
         }
       else
         {
@@ -1217,18 +930,7 @@ apply_single_prop_delete(svn_wc_notify_s
              /* they have the same values, so it's an update */
              apr_hash_set(actual_props, propname, APR_HASH_KEY_STRING, NULL);
            else
-             {
-               SVN_ERR(maybe_generate_propconflict(conflict_remains,
-                                                   db, local_abspath,
-                                                   left_version, right_version,
-                                                   is_dir,
-                                                   propname, actual_props,
-                                                   old_val, NULL,
-                                                   base_val, working_val,
-                                                   conflict_func,
-                                                   conflict_baton,
-                                                   dry_run, scratch_pool));
-             }
+             *conflict_remains = TRUE;
          }
        else
          /* The property is locally deleted from the same value, so it's
@@ -1237,16 +939,7 @@ apply_single_prop_delete(svn_wc_notify_s
     }
 
   else
-    {
-      SVN_ERR(maybe_generate_propconflict(conflict_remains,
-                                          db, local_abspath,
-                                          left_version, right_version,
-                                          is_dir, propname,
-                                          actual_props, old_val, NULL,
-                                          base_val, working_val,
-                                          conflict_func, conflict_baton,
-                                          dry_run, scratch_pool));
-    }
+    *conflict_remains = TRUE;
 
   return SVN_NO_ERROR;
 }
@@ -1264,17 +957,11 @@ apply_single_mergeinfo_prop_change(svn_w
                                    svn_boolean_t *conflict_remains,
                                    svn_wc__db_t *db,
                                    const char *local_abspath,
-                                   const svn_wc_conflict_version_t *left_version,
-                                   const svn_wc_conflict_version_t *right_version,
-                                   svn_boolean_t is_dir,
                                    apr_hash_t *actual_props,
                                    const char *propname,
                                    const svn_string_t *base_val,
                                    const svn_string_t *old_val,
                                    const svn_string_t *new_val,
-                                   svn_wc_conflict_resolver_func2_t conflict_func,
-                                   void *conflict_baton,
-                                   svn_boolean_t dry_run,
                                    apr_pool_t *result_pool,
                                    apr_pool_t *scratch_pool)
 {
@@ -1312,14 +999,7 @@ apply_single_mergeinfo_prop_change(svn_w
       else
         {
           /* There is a base_val but no working_val */
-          SVN_ERR(maybe_generate_propconflict(conflict_remains,
-                                              db, local_abspath,
-                                              left_version, right_version,
-                                              is_dir, propname, actual_props,
-                                              old_val, new_val,
-                                              base_val, working_val,
-                                              conflict_func, conflict_baton,
-                                              dry_run, scratch_pool));
+          *conflict_remains = TRUE;
         }
     }
 
@@ -1376,17 +1056,11 @@ apply_single_generic_prop_change(svn_wc_
                                  svn_boolean_t *conflict_remains,
                                  svn_wc__db_t *db,
                                  const char *local_abspath,
-                                 const svn_wc_conflict_version_t *left_version,
-                                 const svn_wc_conflict_version_t *right_version,
-                                 svn_boolean_t is_dir,
                                  apr_hash_t *actual_props,
                                  const char *propname,
                                  const svn_string_t *base_val,
                                  const svn_string_t *old_val,
                                  const svn_string_t *new_val,
-                                 svn_wc_conflict_resolver_func2_t conflict_func,
-                                 void *conflict_baton,
-                                 svn_boolean_t dry_run,
                                  apr_pool_t *result_pool,
                                  apr_pool_t *scratch_pool)
 {
@@ -1414,14 +1088,7 @@ apply_single_generic_prop_change(svn_wc_
   else
     {
       /* Merge the change. */
-      SVN_ERR(maybe_generate_propconflict(conflict_remains,
-                                          db, local_abspath,
-                                          left_version, right_version,
-                                          is_dir, propname, actual_props,
-                                          old_val, new_val,
-                                          base_val, working_val,
-                                          conflict_func, conflict_baton,
-                                          dry_run, scratch_pool));
+      *conflict_remains = TRUE;
     }
 
   return SVN_NO_ERROR;
@@ -1439,27 +1106,17 @@ apply_single_generic_prop_change(svn_wc_
  * thinks it's overwriting. (Not null.)
  *
  * NEW_VAL contains the value to be set. (Not null.)
- *
- * CONFLICT_FUNC/BATON is a callback to be called before declaring a
- * property conflict;  it gives the client a chance to resolve the
- * conflict interactively.
  */
 static svn_error_t *
 apply_single_prop_change(svn_wc_notify_state_t *state,
                          svn_boolean_t *conflict_remains,
                          svn_wc__db_t *db,
                          const char *local_abspath,
-                         const svn_wc_conflict_version_t *left_version,
-                         const svn_wc_conflict_version_t *right_version,
-                         svn_boolean_t is_dir,
                          apr_hash_t *actual_props,
                          const char *propname,
                          const svn_string_t *base_val,
                          const svn_string_t *old_val,
                          const svn_string_t *new_val,
-                         svn_wc_conflict_resolver_func2_t conflict_func,
-                         void *conflict_baton,
-                         svn_boolean_t dry_run,
                          apr_pool_t *result_pool,
                          apr_pool_t *scratch_pool)
 {
@@ -1485,17 +1142,11 @@ apply_single_prop_change(svn_wc_notify_s
       svn_error_t *err = apply_single_mergeinfo_prop_change(state,
                                                             conflict_remains,
                                                             db, local_abspath,
-                                                            left_version,
-                                                            right_version,
-                                                            is_dir,
                                                             actual_props,
                                                             propname,
                                                             base_val,
                                                             old_val,
                                                             new_val,
-                                                            conflict_func,
-                                                            conflict_baton,
-                                                            dry_run,
                                                             result_pool,
                                                             scratch_pool);
        if (err)
@@ -1518,13 +1169,9 @@ apply_single_prop_change(svn_wc_notify_s
 
       SVN_ERR(apply_single_generic_prop_change(state, conflict_remains,
                                                db, local_abspath,
-                                               left_version, right_version,
-                                               is_dir,
                                                actual_props,
                                                propname, base_val, old_val,
                                                new_val,
-                                               conflict_func, conflict_baton,
-                                               dry_run,
                                                result_pool, scratch_pool));
     }
 
@@ -1533,23 +1180,19 @@ apply_single_prop_change(svn_wc_notify_s
 
 
 svn_error_t *
-svn_wc__merge_props(svn_skel_t **work_items,
+svn_wc__merge_props(svn_skel_t **conflict_skel,
                     svn_wc_notify_state_t *state,
                     apr_hash_t **new_pristine_props,
                     apr_hash_t **new_actual_props,
                     svn_wc__db_t *db,
                     const char *local_abspath,
                     svn_kind_t kind,
-                    const svn_wc_conflict_version_t *left_version,
-                    const svn_wc_conflict_version_t *right_version,
                     apr_hash_t *server_baseprops,
                     apr_hash_t *pristine_props,
                     apr_hash_t *actual_props,
                     const apr_array_header_t *propchanges,
                     svn_boolean_t base_merge,
                     svn_boolean_t dry_run,
-                    svn_wc_conflict_resolver_func2_t conflict_func,
-                    void *conflict_baton,
                     svn_cancel_func_t cancel_func,
                     void *cancel_baton,
                     apr_pool_t *result_pool,
@@ -1557,22 +1200,25 @@ svn_wc__merge_props(svn_skel_t **work_it
 {
   apr_pool_t *iterpool;
   int i;
-  svn_boolean_t is_dir;
-  svn_skel_t *conflict_skel = NULL;
+  apr_hash_t *conflict_props = NULL;
+  apr_hash_t *old_actual_props;
+  apr_hash_t *their_props;
 
   SVN_ERR_ASSERT(pristine_props != NULL);
   SVN_ERR_ASSERT(actual_props != NULL);
 
-  *work_items = NULL;
+  /* Just copy the pointers as we copy the data in the skel if
+     necessary */
+  old_actual_props = apr_hash_copy(scratch_pool, actual_props);
 
   *new_pristine_props = NULL;
   *new_actual_props = NULL;
 
-  is_dir = (kind == svn_kind_dir);
-
   if (!server_baseprops)
     server_baseprops = pristine_props;
 
+  their_props = apr_hash_copy(scratch_pool, server_baseprops);
+
   if (state)
     {
       /* Start out assuming no changes or conflicts.  Don't bother to
@@ -1613,6 +1259,8 @@ svn_wc__merge_props(svn_skel_t **work_it
       /* Save MINE for later message generation.  */
       mine_val = apr_hash_get(actual_props, propname, APR_HASH_KEY_STRING);
 
+      apr_hash_set(their_props, propname, APR_HASH_KEY_STRING, to_val);
+
       /* We already know that state is at least `changed', so mark
          that, but remember that we may later upgrade to `merged' or
          even `conflicted'. */
@@ -1621,31 +1269,23 @@ svn_wc__merge_props(svn_skel_t **work_it
       if (! from_val)  /* adding a new property */
         SVN_ERR(apply_single_prop_add(state, &conflict_remains,
                                       db, local_abspath,
-                                      left_version, right_version,
-                                      is_dir, actual_props,
+                                      actual_props,
                                       propname, base_val, to_val,
-                                      conflict_func, conflict_baton,
-                                      dry_run, result_pool, iterpool));
+                                      result_pool, iterpool));
 
       else if (! to_val) /* delete an existing property */
         SVN_ERR(apply_single_prop_delete(state, &conflict_remains,
                                          db, local_abspath,
-                                         left_version, right_version,
-                                         is_dir,
                                          actual_props,
                                          propname, base_val, from_val,
-                                         conflict_func, conflict_baton,
-                                         dry_run, result_pool, iterpool));
+                                         result_pool, iterpool));
 
       else  /* changing an existing property */
         SVN_ERR(apply_single_prop_change(state, &conflict_remains,
                                          db, local_abspath,
-                                         left_version, right_version,
-                                         is_dir,
                                          actual_props,
                                          propname, base_val, from_val, to_val,
-                                         conflict_func, conflict_baton,
-                                         dry_run, result_pool, iterpool));
+                                         result_pool, iterpool));
 
 
       /* merging logic complete, now we need to possibly log conflict
@@ -1658,17 +1298,11 @@ svn_wc__merge_props(svn_skel_t **work_it
           if (dry_run)
             continue;   /* skip to next incoming change */
 
-          if (conflict_skel == NULL)
-            conflict_skel = svn_wc__conflict_skel_new(result_pool);
+          if (!conflict_props)
+            conflict_props = apr_hash_make(result_pool);
 
-          SVN_ERR(svn_wc__conflict_skel_add_prop_conflict(conflict_skel,
-                                                          propname,
-                                                          base_val,
-                                                          mine_val,
-                                                          to_val,
-                                                          from_val,
-                                                          result_pool,
-                                                          iterpool));
+          apr_hash_set(conflict_props, apr_pstrdup(result_pool, propname),
+                       APR_HASH_KEY_STRING, "");
         }
 
     }  /* foreach propchange ... */
@@ -1682,63 +1316,23 @@ svn_wc__merge_props(svn_skel_t **work_it
   *new_pristine_props = pristine_props;
   *new_actual_props = actual_props;
 
-  if (conflict_skel != NULL)
+  if (conflict_props != NULL)
     {
-      const char *reject_path;
-
-      /* Now try to get the name of a pre-existing .prej file from the
-         entries file */
-      SVN_ERR(svn_wc__get_prejfile_abspath(&reject_path, db, local_abspath,
-                                           scratch_pool, scratch_pool));
+      /* Ok, we got some conflict. Lets store all the property knowledge we
+         have for resolving later */
 
-      if (! reject_path)
-        {
-          /* Reserve a new .prej file *above* the .svn/ directory by
-             opening and closing it. */
-          const char *reject_dirpath;
-          const char *reject_filename;
-          svn_skel_t *work_item;
+      if (!*conflict_skel)
+        *conflict_skel = svn_wc__conflict_skel_create(result_pool);
 
-          if (is_dir)
-            {
-              reject_dirpath = local_abspath;
-              reject_filename = SVN_WC__THIS_DIR_PREJ;
-            }
-          else
-            svn_dirent_split(&reject_dirpath, &reject_filename, local_abspath,
-                             scratch_pool);
-
-          SVN_ERR(svn_io_open_uniquely_named(NULL, &reject_path,
-                                             reject_dirpath,
-                                             reject_filename,
-                                             SVN_WC__PROP_REJ_EXT,
-                                             svn_io_file_del_none,
-                                             scratch_pool, scratch_pool));
-
-          /* This file will be overwritten when the wq is run; that's
-             ok, because at least now we have a reservation on
-             disk. */
-
-          /* Mark entry as "conflicted" with a particular .prej file. */
-          SVN_ERR(svn_wc__wq_tmp_build_set_property_conflict_marker(
-                                          &work_item,
-                                          db, local_abspath, reject_path,
-                                          result_pool, scratch_pool));
-
-          *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
-        }
-
-      /* Once the prejfile is recorded, then install the file.  */
-      {
-        svn_skel_t *work_item;
-
-        SVN_ERR(svn_wc__wq_build_prej_install(&work_item,
-                                              db, local_abspath,
-                                              conflict_skel,
-                                              result_pool, scratch_pool));
-
-        *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
-      }
+      SVN_ERR(svn_wc__conflict_skel_add_prop_conflict(*conflict_skel,
+                                                      db, local_abspath,
+                                                      NULL /* reject_path */,
+                                                      old_actual_props,
+                                                      server_baseprops,
+                                                      their_props,
+                                                      conflict_props,
+                                                      result_pool,
+                                                      scratch_pool));
     }
 
   return SVN_NO_ERROR;

Modified: subversion/branches/javahl-ra/subversion/libsvn_wc/props.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_wc/props.h?rev=1425414&r1=1425413&r2=1425414&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_wc/props.h (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_wc/props.h Sun Dec 23 05:58:52 2012
@@ -91,32 +91,24 @@ svn_wc__internal_propget(const svn_strin
    into the .prej file later. Modify base properties unconditionally,
    if BASE_MERGE is TRUE, they do not generate conficts.
 
-   TODO ### LEFT_VERSION and RIGHT_VERSION ...
-
    TODO ### DRY_RUN ...
 
-   TODO ### CONFLICT_FUNC/CONFLICT_BATON ...
-
    If STATE is non-null, set *STATE to the state of the local properties
    after the merge.  */
 svn_error_t *
-svn_wc__merge_props(svn_skel_t **work_items,
+svn_wc__merge_props(svn_skel_t **conflict_skel,
                     svn_wc_notify_state_t *state,
                     apr_hash_t **new_pristine_props,
                     apr_hash_t **new_actual_props,
                     svn_wc__db_t *db,
                     const char *local_abspath,
                     svn_kind_t kind,
-                    const svn_wc_conflict_version_t *left_version,
-                    const svn_wc_conflict_version_t *right_version,
                     apr_hash_t *server_baseprops,
                     apr_hash_t *pristine_props,
                     apr_hash_t *actual_props,
                     const apr_array_header_t *propchanges,
                     svn_boolean_t base_merge,
                     svn_boolean_t dry_run,
-                    svn_wc_conflict_resolver_func2_t conflict_func,
-                    void *conflict_baton,
                     svn_cancel_func_t cancel_func,
                     void *cancel_baton,
                     apr_pool_t *result_pool,



Mime
View raw message