You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2012/08/06 21:03:11 UTC

svn commit: r1369923 - in /subversion/trunk/subversion: include/private/svn_client_private.h libsvn_client/merge.c svn/merge-cmd.c

Author: julianfoad
Date: Mon Aug  6 19:03:11 2012
New Revision: 1369923

URL: http://svn.apache.org/viewvc?rev=1369923&view=rev
Log:
In symmetric merge, defer the target WC checks for mixed-rev, local mods
and switched subtrees until after determining whether a reintegrate-like
merge is required, so that we can force doing the strict checks if so.

* subversion/include/private/svn_client_private.h
  (svn_client__symmetric_merge_t): Add flags to store the requested
    allow_mixed_rev, allow_local_mods, allow_switched_subtrees options.

* subversion/libsvn_client/merge.c
  (svn_client__find_symmetric_merge): Don't check here; store the options
    instead.
  (do_symmetric_merge_locked): Do the requested checks here, or if it's a
    reintegrate-like merge then force all three of the checks.

* subversion/svn/merge-cmd.c
  (svn_cl__merge): Simplify the code slightly, as we know that the
    'reintegrate' option is false in this block.

Modified:
    subversion/trunk/subversion/include/private/svn_client_private.h
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/svn/merge-cmd.c

Modified: subversion/trunk/subversion/include/private/svn_client_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_client_private.h?rev=1369923&r1=1369922&r2=1369923&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_client_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_client_private.h Mon Aug  6 19:03:11 2012
@@ -183,6 +183,7 @@ svn_client__wc_node_get_origin(svn_clien
 typedef struct svn_client__symmetric_merge_t
 {
   svn_client__pathrev_t *yca, *base, *mid, *right;
+  svn_boolean_t allow_mixed_rev, allow_local_mods, allow_switched_subtrees;
 } svn_client__symmetric_merge_t;
 
 /* Find the information needed to merge all unmerged changes from a source

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1369923&r1=1369922&r2=1369923&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Mon Aug  6 19:03:11 2012
@@ -11558,8 +11558,17 @@ svn_client__find_symmetric_merge(svn_cli
   svn_client__symmetric_merge_t *merge = apr_palloc(result_pool, sizeof(*merge));
 
   SVN_ERR(svn_dirent_get_absolute(&target_abspath, target_wcpath, scratch_pool));
+
+  /* Open RA sessions to the source and target trees.  We're not going
+   * to check the target WC for mixed-rev, local mods or switched
+   * subtrees yet.  After we find out what kind of merge is required,
+   * then if a reintegrate-like merge is required we'll do the stricter
+   * checks, in do_symmetric_merge_locked(). */
   SVN_ERR(open_source_and_target(&s_t, source_path_or_url, source_revision,
-                                 target_abspath, allow_mixed_rev, allow_local_mods, allow_switched_subtrees,
+                                 target_abspath,
+                                 TRUE /*allow_mixed_rev*/,
+                                 TRUE /*allow_local_mods*/,
+                                 TRUE /*allow_switched_subtrees*/,
                                  ctx, result_pool, result_pool, scratch_pool));
 
   /* Check source is in same repos as target. */
@@ -11571,6 +11580,9 @@ svn_client__find_symmetric_merge(svn_cli
                                ctx, result_pool, scratch_pool));
   merge->yca = s_t->yca;
   merge->right = s_t->source;
+  merge->allow_mixed_rev = allow_mixed_rev;
+  merge->allow_local_mods = allow_local_mods;
+  merge->allow_switched_subtrees = allow_switched_subtrees;
 
   *merge_p = merge;
 
@@ -11618,13 +11630,17 @@ do_symmetric_merge_locked(const svn_clie
                           apr_pool_t *scratch_pool)
 {
   merge_target_t *target;
+  svn_boolean_t reintegrate_like = (merge->mid != NULL);
   svn_boolean_t use_sleep = FALSE;
   svn_error_t *err;
 
-  SVN_ERR(open_target_wc(&target, target_abspath, TRUE, TRUE, TRUE,
+  SVN_ERR(open_target_wc(&target, target_abspath,
+                         merge->allow_mixed_rev && ! reintegrate_like,
+                         merge->allow_local_mods && ! reintegrate_like,
+                         merge->allow_switched_subtrees && ! reintegrate_like,
                          ctx, scratch_pool, scratch_pool));
 
-  if (merge->mid)
+  if (reintegrate_like)
     {
       merge_source_t source;
       svn_ra_session_t *base_ra_session = NULL;

Modified: subversion/trunk/subversion/svn/merge-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/merge-cmd.c?rev=1369923&r1=1369922&r2=1369923&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/merge-cmd.c (original)
+++ subversion/trunk/subversion/svn/merge-cmd.c Mon Aug  6 19:03:11 2012
@@ -438,9 +438,6 @@ svn_cl__merge(apr_getopt_t *os,
       && first_range_start.kind == svn_opt_revision_unspecified
       && first_range_end.kind == svn_opt_revision_unspecified)
     {
-      svn_boolean_t allow_local_mods = ! opt_state->reintegrate;
-      svn_boolean_t allow_switched_subtrees = ! opt_state->reintegrate;
-
       SVN_ERR_W(svn_cl__check_related_source_and_target(
                   sourcepath1, &peg_revision1, targetpath, &unspecified,
                   ctx, pool),
@@ -452,8 +449,8 @@ svn_cl__merge(apr_getopt_t *os,
                                   opt_state->record_only,
                                   opt_state->dry_run,
                                   opt_state->allow_mixed_rev,
-                                  allow_local_mods,
-                                  allow_switched_subtrees,
+                                  TRUE /*allow_local_mods*/,
+                                  TRUE /*allow_switched_subtrees*/,
                                   options, ctx, pool);
     }
   else if (opt_state->reintegrate)