subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1369896 - in /subversion/trunk/subversion: include/private/svn_client_private.h libsvn_client/merge.c svn/merge-cmd.c tests/cmdline/merge_reintegrate_tests.py tests/cmdline/merge_tests.py
Date Mon, 06 Aug 2012 17:48:32 GMT
Author: julianfoad
Date: Mon Aug  6 17:48:31 2012
New Revision: 1369896

URL: http://svn.apache.org/viewvc?rev=1369896&view=rev
Log:
Enable symmetric merge as the default 'svn merge' behaviour when there
is one source, no revision range, no --reintegrate option, and no
--ignore-ancestry option.  Ignore the '--symmetric' option.

* subversion/include/private/svn_client_private.h
  (svn_client__symmetric_merge_t): Move structure definition to here ...

* subversion/libsvn_client/merge.c
  (svn_client__symmetric_merge_t): ... from here.
  (do_symmetric_merge_locked): Reject unsupported options in reintegrate
    mode.

* subversion/svn/merge-cmd.c
  (symmetric_merge): If a reintegrate-like merge is required, reject
    options that are unsupported options in reintegrate mode.
  (svn_cl__merge): Do a symmetric merge if there is one source and no
    revision range, '--reintegrate' or '--ignore-ancestry' options.

* subversion/tests/cmdline/merge_tests.py
  (dont_merge_revs_into_subtree_that_predate_it): Mark as XFail, because of
    issue #4217 "Symmetric merge changes merge range notification
    (merge_tests 78)".

* subversion/tests/cmdline/merge_reintegrate_tests.py
  (multiple_reintegrates_from_the_same_branch): Specify the revision range
    explicitly for a record-only merge, since this merge would otherwise be
    a reintegrate-like symmetric merge, for which record-only is no longer
    allowed.

Modified:
    subversion/trunk/subversion/include/private/svn_client_private.h
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/svn/merge-cmd.c
    subversion/trunk/subversion/tests/cmdline/merge_reintegrate_tests.py
    subversion/trunk/subversion/tests/cmdline/merge_tests.py

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=1369896&r1=1369895&r2=1369896&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_client_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_client_private.h Mon Aug  6 17:48:31 2012
@@ -185,7 +185,10 @@ svn_client__wc_node_get_origin(svn_clien
 #ifdef SVN_WITH_SYMMETRIC_MERGE
 
 /* Details of a symmetric merge. */
-typedef struct svn_client__symmetric_merge_t svn_client__symmetric_merge_t;
+typedef struct svn_client__symmetric_merge_t
+{
+  svn_client__pathrev_t *yca, *base, *mid, *right;
+} svn_client__symmetric_merge_t;
 
 /* Find the information needed to merge all unmerged changes from a source
  * branch into a target branch.  The information is the locations of the

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1369896&r1=1369895&r2=1369896&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Mon Aug  6 17:48:31 2012
@@ -11149,12 +11149,6 @@ location_on_branch_at_rev(const branch_h
   return NULL;
 }
 
-/* Details of a symmetric merge. */
-struct svn_client__symmetric_merge_t
-{
-  svn_client__pathrev_t *yca, *base, *mid, *right;
-};
-
 /* */
 typedef struct source_and_target_t
 {
@@ -11653,6 +11647,24 @@ do_symmetric_merge_locked(const svn_clie
       svn_ra_session_t *right_ra_session = NULL;
       svn_ra_session_t *target_ra_session = NULL;
 
+      if (record_only)
+        return svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
+                                _("The required merge is reintegrate-like, "
+                                  "and the record-only option "
+                                  "cannot be used with this kind of merge"));
+
+      if (depth != svn_depth_unknown)
+        return svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
+                                _("The required merge is reintegrate-like, "
+                                  "and the depth option "
+                                  "cannot be used with this kind of merge"));
+
+      if (force)
+        return svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
+                                _("The required merge is reintegrate-like, "
+                                  "and the force option "
+                                  "cannot be used with this kind of merge"));
+
       SVN_ERR(ensure_ra_session_url(&base_ra_session, merge->base->url,
                                     ctx, scratch_pool));
       SVN_ERR(ensure_ra_session_url(&right_ra_session, merge->right->url,

Modified: subversion/trunk/subversion/svn/merge-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/merge-cmd.c?rev=1369896&r1=1369895&r2=1369896&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/merge-cmd.c (original)
+++ subversion/trunk/subversion/svn/merge-cmd.c Mon Aug  6 17:48:31 2012
@@ -122,6 +122,7 @@ symmetric_merge(const char *source_path_
                 apr_pool_t *scratch_pool)
 {
   svn_client__symmetric_merge_t *merge;
+  svn_boolean_t reintegrate_like;
 
   /* Find the 3-way merges needed (and check suitability of the WC). */
   SVN_ERR(svn_client__find_symmetric_merge(&merge,
@@ -130,6 +131,35 @@ symmetric_merge(const char *source_path_
                                            allow_local_mods, allow_switched_subtrees,
                                            ctx, scratch_pool, scratch_pool));
 
+  reintegrate_like = (merge->mid != NULL);
+
+  if (reintegrate_like)
+    {
+      if (record_only)
+        return svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL,
+                                _("The required merge is reintegrate-like, "
+                                  "and the --record-only option "
+                                  "cannot be used with this kind of merge"));
+
+      if (depth != svn_depth_unknown)
+        return svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL,
+                                _("The required merge is reintegrate-like, "
+                                  "and the --depth option "
+                                  "cannot be used with this kind of merge"));
+
+      if (force)
+        return svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL,
+                                _("The required merge is reintegrate-like, "
+                                  "and the --force option "
+                                  "cannot be used with this kind of merge"));
+
+      if (allow_mixed_rev)
+        return svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL,
+                                _("The required merge is reintegrate-like, "
+                                  "and the --allow-mixed-revisions option "
+                                  "cannot be used with this kind of merge"));
+    }
+
   /* Perform the 3-way merges */
   SVN_ERR(svn_client__do_symmetric_merge(merge, target_wcpath, depth,
                                          force, record_only,
@@ -404,22 +434,16 @@ svn_cl__merge(apr_getopt_t *os,
    * If any conflicts occur we'll run the conflict resolver later. */
 
 #ifdef SVN_WITH_SYMMETRIC_MERGE
-  if (opt_state->symmetric_merge)
+  /* Do a symmetric merge if just one source and no revisions. */
+  if ((! two_sources_specified)
+      && (! opt_state->reintegrate)
+      && (! opt_state->ignore_ancestry)
+      && 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;
 
-      if (two_sources_specified)
-        return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-                                _("SOURCE2 can't be used with --symmetric"));
-      if (first_range_start.kind != svn_opt_revision_unspecified
-          || first_range_end.kind != svn_opt_revision_unspecified)
-        return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-                                _("a revision range can't be used with --symmetric"));
-      if (opt_state->ignore_ancestry)
-        return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-                                _("--ignore-ancestry can't be used with --symmetric"));
-
       SVN_ERR_W(svn_cl__check_related_source_and_target(
                   sourcepath1, &peg_revision1, targetpath, &unspecified,
                   ctx, pool),

Modified: subversion/trunk/subversion/tests/cmdline/merge_reintegrate_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_reintegrate_tests.py?rev=1369896&r1=1369895&r2=1369896&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_reintegrate_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/merge_reintegrate_tests.py Mon Aug  6 17:48:31
2012
@@ -1503,7 +1503,7 @@ def multiple_reintegrates_from_the_same_
   # r12 - Do a --record-only merge from 'A' to the feature branch so we
   # don't try to merge r11 from trunk during the next sync merge.
   svntest.actions.run_and_verify_svn(None, None, [], 'up', wc_dir)
-  svntest.actions.run_and_verify_svn(None, None, [], 'merge',
+  svntest.actions.run_and_verify_svn(None, None, [], 'merge', '-c11',
                                      '--record-only',
                                      sbox.repo_url + '/A',
                                      Feature_branch_path)

Modified: subversion/trunk/subversion/tests/cmdline/merge_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_tests.py?rev=1369896&r1=1369895&r2=1369896&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/merge_tests.py Mon Aug  6 17:48:31 2012
@@ -11063,7 +11063,8 @@ def reverse_merge_away_all_mergeinfo(sbo
 # merge'.  Specifically see
 # http://subversion.tigris.org/issues/show_bug.cgi?id=3067#desc5
 @SkipUnless(server_has_mergeinfo)
-@Issues(3138,3067)
+@XFail()
+@Issues(3138,3067,4217)
 def dont_merge_revs_into_subtree_that_predate_it(sbox):
   "dont merge revs into a subtree that predate it"
 



Mime
View raw message