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 2011/07/14 18:28:47 UTC

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

Author: julianfoad
Date: Thu Jul 14 16:28:47 2011
New Revision: 1146781

URL: http://svn.apache.org/viewvc?rev=1146781&view=rev
Log:
Fix a bug in subtree merging.

Found by: Barry Scott <barry{_AT_}barrys-emacs.org>

* subversion/libsvn_client/merge.c
  (adjust_deleted_subtree_ranges): Don't pass an empty rangelist to
    svn_rangelist_intersect(), because that's invalid and throws an
    assertion failure; instead, construct the result manually.

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=1146781&r1=1146780&r2=1146781&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Thu Jul 14 16:28:47 2011
@@ -2903,21 +2903,34 @@ adjust_deleted_subtree_ranges(svn_client
                                                 scratch_pool));
                 }
 
-              /* Create a rangelist describing the range PRIMARY_URL@older_rev
-                 exists and find the intersection of that and
-                 CHILD->REMAINING_RANGES. */
-              exists_rangelist =
-                svn_rangelist__initialize(older_rev,
-                                          revision_primary_url_deleted - 1,
-                                          TRUE, scratch_pool);
-              SVN_ERR(svn_rangelist_intersect(&(child->remaining_ranges),
-                                              exists_rangelist,
-                                              child->remaining_ranges,
-                                              FALSE, scratch_pool));
+              /* Find the intersection of CHILD->REMAINING_RANGES with the
+                 range over which PRIMARY_URL@older_rev exists (ending at
+                 the youngest revision at which it still exists). */
+              if (revision_primary_url_deleted - 1 > older_rev)
+                {
+                  /* It was not deleted immediately after OLDER_REV, so
+                     it has some relevant changes. */
+                  exists_rangelist =
+                    svn_rangelist__initialize(older_rev,
+                                              revision_primary_url_deleted - 1,
+                                              TRUE, scratch_pool);
+                  SVN_ERR(svn_rangelist_intersect(&(child->remaining_ranges),
+                                                  exists_rangelist,
+                                                  child->remaining_ranges,
+                                                  FALSE, scratch_pool));
+                }
+              else
+                {
+                  /* It was deleted immediately after the OLDER rev, so
+                     it has no relevant changes. */
+                  child->remaining_ranges
+                    = apr_array_make(scratch_pool, 0,
+                                     sizeof(svn_merge_range_t *));
+                }
 
-              /* Create a second rangelist describing the range beginning when
-                 PRIMARY_URL@older_rev was deleted until younger_rev.  Then
-                 find the intersection of that and PARENT->REMAINING_RANGES.
+              /* Find the intersection of PARENT->REMAINING_RANGES with the
+                 range beginning when PRIMARY_URL@older_rev was deleted
+                 until younger_rev.
                  Finally merge this rangelist with the rangelist above and
                  store the result in CHILD->REMANING_RANGES. */
               deleted_rangelist =