Author: pburba
Date: Tue Mar 16 16:34:33 2010
New Revision: 923852

URL: http://svn.apache.org/viewvc?rev=923852&view=rev
Log:
On the 1.6.x-r892050 branch, merge r892085 from trunk.


Modified:
    subversion/branches/1.6.x-r892050/   (props changed)
    subversion/branches/1.6.x-r892050/subversion/libsvn_client/merge.c
    subversion/branches/1.6.x-r892050/subversion/tests/cmdline/merge_tests.py

Propchange: subversion/branches/1.6.x-r892050/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 16 16:34:33 2010
@@ -61,4 +61,4 @@
 /subversion/branches/tc_url_rev:870696-870828
 /subversion/branches/tree-conflicts:864636-869499
 /subversion/branches/tree-conflicts-notify:870271-870353
-/subversion/trunk:875976,875980-875981,876054-876056,876092,876175,876299,876306,876427,876440,876450,876507,876571,879093,879688,880274-880275,880370,880450,880474,880525-880526,880552,881905,884842,886164,886197,888715,888979,889081,889840,891672,892050,895514,895653,896522,898963,899826,899828,900797,901752,904301,904394,904594,905303,905326,906256,906305,917640,918211,922516
+/subversion/trunk:875976,875980-875981,876054-876056,876092,876175,876299,876306,876427,876440,876450,876507,876571,879093,879688,880274-880275,880370,880450,880474,880525-880526,880552,881905,884842,886164,886197,888715,888979,889081,889840,891672,892050,892085,895514,895653,896522,898963,899826,899828,900797,901752,904301,904394,904594,905303,905326,906256,906305,917640,918211,922516

Modified: subversion/branches/1.6.x-r892050/subversion/libsvn_client/merge.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.6.x-r892050/subversion/libsvn_client/merge.c?rev=923852&r1=923851&r2=923852&view=diff
==============================================================================
--- subversion/branches/1.6.x-r892050/subversion/libsvn_client/merge.c 
(original)
+++ subversion/branches/1.6.x-r892050/subversion/libsvn_client/merge.c Tue Mar 
16 16:34:33 2010
@@ -7663,6 +7663,9 @@ ensure_all_missing_ranges_are_phantoms(s
    p...@target_rev.  Effectively this is the mergeinfo catalog on the
    reintegrate target.
 
+   YC_ANCESTOR_REV is the revision of the youngest common ancestor of the
+   reintegrate source and the reintegrate target.
+
    SOURCE_REPOS_REL_PATH is the path of the reintegrate source relative to
    the root of the repository.  TARGET_REPOS_REL_PATH is the path of the
    reintegrate target relative to the root of the repository.
@@ -7696,6 +7699,7 @@ static svn_error_t *
 find_unmerged_mergeinfo(svn_mergeinfo_catalog_t *unmerged_to_source_catalog,
                         svn_boolean_t *never_synched,
                         svn_revnum_t *youngest_merged_rev,
+                        svn_revnum_t yc_ancestor_rev,
                         svn_mergeinfo_catalog_t source_catalog,
                         apr_hash_t *target_segments_hash,
                         const char *source_repos_rel_path,
@@ -7745,6 +7749,16 @@ find_unmerged_mergeinfo(svn_mergeinfo_ca
                                                   segments,
                                                   iterpool));
 
+      /* Remove any target history that is also part of the source's history,
+         i.e. their common ancestry.  By definition this has already been
+         "merged" from the target to the source.  If the source has explict
+         self referential mergeinfo it would intersect with the target's
+         history below, making it appear that some merges had been done from
+         the target to the source, when this might not actually be the case. */
+      SVN_ERR(svn_mergeinfo__filter_mergeinfo_by_ranges(
+        &target_history_as_mergeinfo, target_history_as_mergeinfo,
+        source_rev, yc_ancestor_rev, iterpool));
+
       /* Look for any explicit mergeinfo on the source path corresponding to
          the target path.  If we find any remove that from SOURCE_CATALOG.
          When this iteration over TARGET_SEGMENTS_HASH is complete all that
@@ -8034,6 +8048,9 @@ calculate_left_hand_side(const char **ur
   apr_hash_t *segments_hash = apr_hash_make(pool);
   svn_boolean_t never_synced;
   svn_revnum_t youngest_merged_rev;
+  const char *yc_ancestor_path;
+  const char *source_url;
+  const char *target_url;
 
   /* Get the history (segments) for the target and any of its subtrees
      with explicit mergeinfo. */
@@ -8058,6 +8075,26 @@ calculate_left_hand_side(const char **ur
                    APR_HASH_KEY_STRING, segments);
     }
 
+  /* Check that source_...@source_rev and target_...@target_rev are
+     actually related, we can't reintegrate if they are not.  Also
+     get an initial value for *REV_LEFT. */
+  source_url = svn_path_url_add_component2(source_repos_root,
+                                           source_repos_rel_path,
+                                           subpool),
+  target_url = svn_path_url_add_component2(source_repos_root,
+                                           target_repos_rel_path,
+                                           subpool);
+  SVN_ERR(svn_client__get_youngest_common_ancestor(&yc_ancestor_path,
+                                                   rev_left,
+                                                   source_url, source_rev,
+                                                   target_url, target_rev,
+                                                   ctx, subpool));
+  if (!(yc_ancestor_path && SVN_IS_VALID_REVNUM(*rev_left)))
+    return svn_error_createf(SVN_ERR_CLIENT_NOT_READY_TO_MERGE, NULL,
+                             _("'%...@%ld' must be ancestrally related to "
+                               "'%...@%ld'"), source_url, source_rev,
+                             target_url, target_rev);
+
   /* Get the mergeinfo from the source, including its descendants
      with differing explicit mergeinfo. */
   APR_ARRAY_PUSH(source_repos_rel_path_as_array, const char *)
@@ -8075,6 +8112,7 @@ calculate_left_hand_side(const char **ur
   SVN_ERR(find_unmerged_mergeinfo(&unmerged_catalog,
                                   &never_synced,
                                   &youngest_merged_rev,
+                                  *rev_left,
                                   mergeinfo_catalog,
                                   segments_hash,
                                   source_repos_rel_path,
@@ -8094,24 +8132,6 @@ calculate_left_hand_side(const char **ur
   if (never_synced)
     {
       /* We never merged to the source.  Just return the branch point. */
-      const char *yc_ancestor_path,
-        *source_url = svn_path_url_add_component2(source_repos_root,
-                                                  source_repos_rel_path,
-                                                  subpool),
-        *target_url = svn_path_url_add_component2(source_repos_root,
-                                                  target_repos_rel_path,
-                                                  subpool);
-
-      SVN_ERR(svn_client__get_youngest_common_ancestor(&yc_ancestor_path,
-                                                       rev_left,
-                                                       source_url, source_rev,
-                                                       target_url, target_rev,
-                                                       ctx, subpool));
-      if (!(yc_ancestor_path && SVN_IS_VALID_REVNUM(*rev_left)))
-        return svn_error_createf(SVN_ERR_CLIENT_NOT_READY_TO_MERGE, NULL,
-                                 _("'%...@%ld' must be ancestrally related to "
-                                   "'%...@%ld'"), source_url, source_rev,
-                                 target_url, target_rev);
       *url_left = svn_path_url_add_component2(source_repos_root,
                                               yc_ancestor_path, pool);
     }

Modified: 
subversion/branches/1.6.x-r892050/subversion/tests/cmdline/merge_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.6.x-r892050/subversion/tests/cmdline/merge_tests.py?rev=923852&r1=923851&r2=923852&view=diff
==============================================================================
--- subversion/branches/1.6.x-r892050/subversion/tests/cmdline/merge_tests.py 
(original)
+++ subversion/branches/1.6.x-r892050/subversion/tests/cmdline/merge_tests.py 
Tue Mar 16 16:34:33 2010
@@ -16121,6 +16121,10 @@ def merge_replace_causes_tree_conflict(s
 
   actions.run_and_verify_status(wc_dir, expected_status)
 
+# Test for a reintegrate bug which can occur when the merge source
+# has mergeinfo that explicitly describes common history with the reintegrate
+# target, see http://mail-archives.apache.org/mod_mbox/subversion-dev/
+# 200912.mbox/%3c6cfe18eb0912161438wfb5234bj118aacdff7ffb...@mail.gmail.com%3e
 def reintegrate_with_self_referential_mergeinfo(sbox):
   "source has target's history as explicit mergeinfo"
 
@@ -16219,7 +16223,7 @@ def reintegrate_with_self_referential_me
     'D/H/omega' : Item("New content"),
     })
   expected_skip = wc.State(A2_path, { })
-  # Currently failing with this error:
+  # Previously failed with this error:
   #
   #   svn merge ^/A2.1" A2 --reintegrate
   #  ..\..\..\subversion\svn\merge-cmd.c:349: (apr_err=160013)
@@ -16461,7 +16465,7 @@ test_list = [ None,
               # ra_serf causes duplicate notifications with this test:
               Skip(merge_replace_causes_tree_conflict,
                    svntest.main.is_ra_type_dav_serf),
-              XFail(reintegrate_with_self_referential_mergeinfo),
+              reintegrate_with_self_referential_mergeinfo,
              ]
 
 if __name__ == '__main__':


Reply via email to