You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2012/05/10 18:34:39 UTC

svn commit: r1336779 - /subversion/trunk/subversion/libsvn_client/merge.c

Author: rhuijben
Date: Thu May 10 16:34:39 2012
New Revision: 1336779

URL: http://svn.apache.org/viewvc?rev=1336779&view=rev
Log:
Remove merge_props_changed(), moving the code into its two callers. This makes
it easier to observe the output argument behavior of the diff callbacks and
will allow integrating the property and text processing in a single atomic wc
operation.

* subversion/libsvn_client/merge.c
  (prepare_merge_props_changed): Rename argument to result_pool.
  (merge_props_changed): Remove code. Folding code into its callers.
  (merge_dir_props_changed): Update caller.
  (merge_file_changed): Update caller.

Modified:
    subversion/trunk/subversion/libsvn_client/merge.c

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1336779&r1=1336778&r2=1336779&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Thu May 10 16:34:39 2012
@@ -1140,21 +1140,21 @@ prepare_merge_props_changed(const apr_ar
                             const char *local_abspath,
                             const apr_array_header_t *propchanges,
                             merge_cmd_baton_t *merge_b,
-                            apr_pool_t *scratch_pool)
+                            apr_pool_t *result_pool)
 {
   apr_array_header_t *props;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
   SVN_ERR(svn_categorize_props(propchanges, NULL, NULL, &props,
-                               scratch_pool));
+                               result_pool));
 
   /* If we are only applying mergeinfo changes then we need to do
      additional filtering of PROPS so it contains only mergeinfo changes. */
   if (merge_b->record_only && props->nelts)
     {
       apr_array_header_t *mergeinfo_props =
-        apr_array_make(scratch_pool, 1, sizeof(svn_prop_t));
+        apr_array_make(result_pool, 1, sizeof(svn_prop_t));
       int i;
 
       for (i = 0; i < props->nelts; i++)
@@ -1188,58 +1188,13 @@ prepare_merge_props_changed(const apr_ar
                                                   merge_b->reintegrate_merge,
                                                   merge_b->ra_session2,
                                                   merge_b->ctx,
-                                                  scratch_pool));
+                                                  result_pool));
     }
   *prop_updates = props;
 
   return SVN_NO_ERROR;
 }
 
-/* Perform a property merge of the property changes PROPS on LOCAL_ABSPATH. The
-   original properties are stored in ORIGINAL_PROPS.
-
-   Used for both file and directory property merges. */
-static svn_error_t *
-merge_props_changed(svn_wc_notify_state_t *state,
-                    svn_boolean_t *tree_conflicted,
-                    const char *local_abspath,
-                    const apr_array_header_t *props,
-                    apr_hash_t *original_props,
-                    merge_cmd_baton_t *merge_b,
-                    apr_pool_t *scratch_pool)
-{
-  svn_client_ctx_t *ctx = merge_b->ctx;
-
-  /* We only want to merge "regular" version properties:  by
-     definition, 'svn merge' shouldn't touch any pristine data  */
-  if (props->nelts)
-    {
-      svn_error_t *err;
-      err = svn_wc_merge_props3(state, ctx->wc_ctx, local_abspath, NULL, NULL,
-                                original_props, props, merge_b->dry_run,
-                                ctx->conflict_func2, ctx->conflict_baton2,
-                                ctx->cancel_func, ctx->cancel_baton,
-                                scratch_pool);
-
-      if (err && (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND
-                  || err->apr_err == SVN_ERR_WC_PATH_UNEXPECTED_STATUS))
-        {
-          /* If the entry doesn't exist in the wc, this is a tree-conflict. */
-          if (state)
-            *state = svn_wc_notify_state_missing;
-          if (tree_conflicted)
-            *tree_conflicted = TRUE;
-          svn_error_clear(err);
-        }
-      else if (err)
-        return svn_error_trace(err);
-    }
-  else if (state)
-    *state = svn_wc_notify_state_unchanged;
-
-  return SVN_NO_ERROR;
-}
-
 /* If this is not a dry run then make a record in BATON if we find a
    LOCAL_ABSPATH where mergeinfo is added where none existed previously or
    LOCAL_ABSPATH is having its existing mergeinfo deleted.
@@ -1353,10 +1308,41 @@ merge_dir_props_changed(svn_wc_notify_st
 
   SVN_ERR(prepare_merge_props_changed(&props, local_abspath, propchanges,
                                       merge_b, scratch_pool));
-  SVN_ERR(merge_props_changed(state, tree_conflicted, local_abspath, props,
-                              original_props, merge_b, scratch_pool));
-  return svn_error_trace(record_mergeinfo_prop_change(local_abspath, props,
-                                                      merge_b, scratch_pool));
+
+  /* We only want to merge "regular" version properties:  by
+     definition, 'svn merge' shouldn't touch any pristine data  */
+  if (props->nelts)
+    {
+      svn_error_t *err;
+      svn_client_ctx_t *ctx = merge_b->ctx;
+
+      err = svn_wc_merge_props3(state, ctx->wc_ctx, local_abspath,
+                                NULL, NULL, original_props, props,
+                                merge_b->dry_run,
+                                ctx->conflict_func2, ctx->conflict_baton2,
+                                ctx->cancel_func, ctx->cancel_baton,
+                                scratch_pool);
+
+      if (err && (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND
+                  || err->apr_err == SVN_ERR_WC_PATH_UNEXPECTED_STATUS))
+        {
+          /* If the entry doesn't exist in the wc, this is a tree-conflict. */
+          if (state)
+            *state = svn_wc_notify_state_missing;
+          if (tree_conflicted)
+            *tree_conflicted = TRUE;
+          svn_error_clear(err);
+        }
+      else if (err)
+        return svn_error_trace(err);
+
+      SVN_ERR(record_mergeinfo_prop_change(local_abspath, props,
+                                           merge_b, scratch_pool));
+    }
+  else if (state)
+    *state = svn_wc_notify_state_unchanged;
+
+  return SVN_NO_ERROR;
 }
 
 /* Contains any state collected while resolving conflicts. */
@@ -1510,6 +1496,7 @@ merge_file_changed(svn_wc_notify_state_t
                    apr_pool_t *scratch_pool)
 {
   merge_cmd_baton_t *merge_b = baton;
+  svn_client_ctx_t *ctx = merge_b->ctx;
   const char *mine_abspath = svn_dirent_join(merge_b->target->abspath,
                                              mine_relpath, scratch_pool);
   svn_node_kind_t wc_kind;
@@ -1639,27 +1626,48 @@ merge_file_changed(svn_wc_notify_state_t
      into account the new property values. */
   if (prop_changes->nelts > 0)
     {
-      svn_boolean_t tree_conflicted2 = FALSE;
       const apr_array_header_t *props;
+      svn_boolean_t tree_conflicted2 = FALSE;
 
       SVN_ERR(prepare_merge_props_changed(&props, mine_abspath, prop_changes,
                                           merge_b, scratch_pool));
 
-      SVN_ERR(merge_props_changed(prop_state, &tree_conflicted2,
-                                  mine_abspath, props, original_props,
-                                  merge_b, scratch_pool));
+      /* We only want to merge "regular" version properties:  by
+         definition, 'svn merge' shouldn't touch any pristine data */
+      if (props->nelts)
+        {
+          svn_error_t *err;
+
+          err = svn_wc_merge_props3(prop_state, ctx->wc_ctx, mine_abspath,
+                                    NULL, NULL,
+                                    original_props, props, merge_b->dry_run,
+                                    ctx->conflict_func2, ctx->conflict_baton2,
+                                    ctx->cancel_func, ctx->cancel_baton,
+                                    scratch_pool);
 
-      SVN_ERR(record_mergeinfo_prop_change(mine_abspath, props, merge_b,
+          if (err && (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND
+                      || err->apr_err == SVN_ERR_WC_PATH_UNEXPECTED_STATUS))
+            {
+              /* If the entry doesn't exist in the wc, this is a tree-conflict. */
+              if (prop_state)
+                *prop_state = svn_wc_notify_state_missing;
+              if (tree_conflicted)
+                *tree_conflicted = tree_conflicted2 = TRUE;
+              svn_error_clear(err);
+            }
+          else if (err)
+            return svn_error_trace(err);
+
+          SVN_ERR(record_mergeinfo_prop_change(mine_abspath, props, merge_b,
                                            scratch_pool));
+        }
+      else if (prop_state)
+        *prop_state = svn_wc_notify_state_unchanged;
+
 
       /* If the prop change caused a tree-conflict, just bail. */
       if (tree_conflicted2)
-        {
-          if (tree_conflicted != NULL)
-            *tree_conflicted = TRUE;
-
-          return SVN_NO_ERROR;
-        }
+        return SVN_NO_ERROR;
     }
   else if (prop_state)
     *prop_state = svn_wc_notify_state_unchanged;