Author: cmpilato
Date: Mon Jun 13 17:01:16 2011
New Revision: 1135176

URL: http://svn.apache.org/viewvc?rev=1135176&view=rev
Log:
Fix issue #3918 ("--reintegrate trunk to self triggers assertion
failure").

* subversion/libsvn_client/merge.c
  (calculate_left_hand_side): Tweak the promise to indicate that if
    there's nothing to do, the return values will be set to sentinel
    values.  If the youngest common ancestor revision is the same as
    the source revision, claim that there's nothing to do.
  (merge_reintegrate_locked): Detect sentinel return values from
    calculate_left_hand_side(), returning without error if they are
    spotted.

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=1135176&r1=1135175&r2=1135176&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Mon Jun 13 17:01:16 2011
@@ -10138,7 +10138,8 @@ find_unmerged_mergeinfo(svn_mergeinfo_ca
 
 /* Helper for svn_client_merge_reintegrate() which calculates the
    'left hand side' of the underlying two-URL merge that a --reintegrate
-   merge actually performs.
+   merge actually performs.  If no merge should be performed, set
+   *URL_LEFT to NULL and *REV_LEFT to SVN_INVALID_REVNUM.
 
    TARGET_ABSPATH is the absolute working copy path of the reintegrate
    merge.
@@ -10201,6 +10202,10 @@ calculate_left_hand_side(const char **ur
   const char *source_url;
   const char *target_url;
 
+  /* Initialize our return variables. */
+  *url_left = NULL;
+  *rev_left = SVN_INVALID_REVNUM;
+     
   /* TARGET_ABSPATH may not have explicit mergeinfo and thus may not be
      contained within SUBTREES_WITH_MERGEINFO.  If this is the case then
      add a dummy item for TARGET_ABSPATH so we get its history (i.e. implicit
@@ -10281,6 +10286,15 @@ calculate_left_hand_side(const char **ur
                              _("'%s@%ld' must be ancestrally related to "
                                "'%s@%ld'"), source_url, source_rev,
                              target_url, target_rev);
+
+  /* If the source revision is the same as the youngest common
+     revision, then there can't possibly be any unmerged revisions
+     that we need to apply to target.  (Since it */
+  if (source_rev == yc_ancestor_rev)
+    {
+      svn_pool_destroy(iterpool);
+      return SVN_NO_ERROR;
+    }
     
   /* Get the mergeinfo from the source, including its descendants
      with differing explicit mergeinfo. */
@@ -10495,6 +10509,11 @@ merge_reintegrate_locked(const char *sou
                                    ctx,
                                    scratch_pool, scratch_pool));
 
+  /* Did calculate_left_hand_side() decide that there was no merge to
+     be performed here?  */
+  if (! url1)
+    return SVN_NO_ERROR;
+
   /* If the target was moved after the source was branched from it,
      it is possible that the left URL differs from the target's current
      URL.  If so, then adjust TARGET_RA_SESSION to point to the old URL. */


Reply via email to