You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by pb...@apache.org on 2011/04/25 20:52:21 UTC

svn commit: r1096562 - in /subversion/trunk/subversion/libsvn_client: merge.c mergeinfo.c mergeinfo.h ra.c

Author: pburba
Date: Mon Apr 25 18:52:21 2011
New Revision: 1096562

URL: http://svn.apache.org/viewvc?rev=1096562&view=rev
Log:
* subversion/libsvn_client/merge.c

  (filter_self_referential_mergeinfo,
   get_full_mergeinfo,
   find_gaps_in_merge_source_history):
   Update calls to svn_client__get_history_as_mergeinfo().

* subversion/libsvn_client/mergeinfo.c

  (svn_client__get_history_as_mergeinfo):

  (svn_client_mergeinfo_log): Update call to
   svn_client__get_history_as_mergeinfo().

* subversion/libsvn_client/mergeinfo.h

  (svn_client__get_history_as_mergeinfo):

* subversion/libsvn_client/ra.c

  (svn_client__get_youngest_common_ancestor): Handle the case where the
   youngest common ancestor is revision 0.

Modified:
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/libsvn_client/mergeinfo.c
    subversion/trunk/subversion/libsvn_client/mergeinfo.h
    subversion/trunk/subversion/libsvn_client/ra.c

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1096562&r1=1096561&r2=1096562&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Mon Apr 25 18:52:21 2011
@@ -1017,7 +1017,7 @@ filter_self_referential_mergeinfo(apr_ar
           peg_rev.kind = svn_opt_revision_number;
           peg_rev.value.number = base_revision;
           SVN_ERR(svn_client__get_history_as_mergeinfo(
-            &implicit_mergeinfo,
+            &implicit_mergeinfo, NULL,
             local_abspath, &peg_rev,
             base_revision,
             SVN_INVALID_REVNUM,
@@ -3536,6 +3536,7 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
           peg_revision.kind = svn_opt_revision_number;
           peg_revision.value.number = target_rev;
           SVN_ERR(svn_client__get_history_as_mergeinfo(implicit_mergeinfo,
+                                                       NULL,
                                                        url, &peg_revision,
                                                        start, end,
                                                        ra_session, ctx,
@@ -4154,10 +4155,10 @@ find_gaps_in_merge_source_history(svn_re
   /* Get URL1@REVISION1:URL2@REVISION2 as mergeinfo. */
   peg_rev.kind = svn_opt_revision_number;
   peg_rev.value.number = young_rev;
-  SVN_ERR(svn_client__get_history_as_mergeinfo(&implicit_src_mergeinfo, url,
-                                               &peg_rev, young_rev, old_rev,
-                                               ra_session, merge_b->ctx,
-                                               scratch_pool));
+  SVN_ERR(svn_client__get_history_as_mergeinfo(&implicit_src_mergeinfo, NULL,
+                                               url, &peg_rev, young_rev,
+                                               old_rev, ra_session,
+                                               merge_b->ctx, scratch_pool));
 
   rangelist = apr_hash_get(implicit_src_mergeinfo,
                            merge_src_canon_path,

Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=1096562&r1=1096561&r2=1096562&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Mon Apr 25 18:52:21 2011
@@ -633,6 +633,7 @@ svn_client__get_wc_or_repos_mergeinfo_ca
 
 svn_error_t *
 svn_client__get_history_as_mergeinfo(svn_mergeinfo_t *mergeinfo_p,
+                                     svn_boolean_t *has_rev_zero_history,
                                      const char *path_or_url,
                                      const svn_opt_revision_t *peg_revision,
                                      svn_revnum_t range_youngest,
@@ -674,6 +675,18 @@ svn_client__get_history_as_mergeinfo(svn
                                               peg_revnum, range_youngest,
                                               range_oldest, ctx, pool));
 
+  if (has_rev_zero_history)
+    {
+      *has_rev_zero_history = FALSE;
+        if (segments->nelts)
+          {
+            svn_location_segment_t *oldest_segment =
+              APR_ARRAY_IDX(segments, 0, svn_location_segment_t *);
+            if (oldest_segment->range_start == 0)
+              *has_rev_zero_history = TRUE;
+          }
+    }
+
   SVN_ERR(svn_mergeinfo__mergeinfo_from_segments(mergeinfo_p, segments, pool));
 
   /* If we opened an RA session, ensure its closure. */
@@ -1704,14 +1717,14 @@ svn_client_mergeinfo_log(svn_boolean_t f
     }
 
   if (!finding_merged)
-    SVN_ERR(svn_client__get_history_as_mergeinfo(&path_or_url_history,
+    SVN_ERR(svn_client__get_history_as_mergeinfo(&path_or_url_history, NULL,
                                                  path_or_url,
                                                  peg_revision,
                                                  SVN_INVALID_REVNUM,
                                                  SVN_INVALID_REVNUM,
                                                  NULL, ctx, scratch_pool));
 
-  SVN_ERR(svn_client__get_history_as_mergeinfo(&source_history,
+  SVN_ERR(svn_client__get_history_as_mergeinfo(&source_history, NULL,
                                                merge_source_url,
                                                real_src_peg_revision,
                                                SVN_INVALID_REVNUM,

Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.h?rev=1096562&r1=1096561&r2=1096562&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.h (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.h Mon Apr 25 18:52:21 2011
@@ -265,9 +265,14 @@ svn_client__get_wc_or_repos_mergeinfo_ca
    session whose session URL maps to PATH_OR_URL's URL, or NULL.
    If RANGE_YOUNGEST and RANGE_OLDEST are valid, use them to bound the
    revision ranges of returned mergeinfo.  See svn_ra_get_location_segments()
-   for the rules governing PEG_REVISION, START_REVISION, and END_REVISION.*/
+   for the rules governing PEG_REVISION, START_REVISION, and END_REVISION.
+
+   If HAS_REV_ZERO_HISTORY is not NULL, then set *HAS_REV_ZERO_HISTORY to
+   TRUE if the natural history of PATH_OR_URL@PEG_REVISION includes
+   revision 0.  Set *HAS_REV_ZERO_HISTORY to FALSE otherwise. */
 svn_error_t *
 svn_client__get_history_as_mergeinfo(svn_mergeinfo_t *mergeinfo_p,
+                                     svn_boolean_t *has_rev_zero_history,
                                      const char *path_or_url,
                                      const svn_opt_revision_t *peg_revision,
                                      svn_revnum_t range_youngest,

Modified: subversion/trunk/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/ra.c?rev=1096562&r1=1096561&r2=1096562&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/ra.c (original)
+++ subversion/trunk/subversion/libsvn_client/ra.c Mon Apr 25 18:52:21 2011
@@ -762,6 +762,8 @@ svn_client__get_youngest_common_ancestor
   svn_revnum_t yc_revision = SVN_INVALID_REVNUM;
   const char *yc_path = NULL;
   svn_opt_revision_t revision1, revision2;
+  svn_boolean_t has_rev_zero_history1;
+  svn_boolean_t has_rev_zero_history2;
 
   revision1.kind = revision2.kind = svn_opt_revision_number;
   revision1.value.number = rev1;
@@ -769,12 +771,16 @@ svn_client__get_youngest_common_ancestor
 
   /* We're going to cheat and use history-as-mergeinfo because it
      saves us a bunch of annoying custom data comparisons and such. */
-  SVN_ERR(svn_client__get_history_as_mergeinfo(&history1, path_or_url1,
+  SVN_ERR(svn_client__get_history_as_mergeinfo(&history1,
+                                               &has_rev_zero_history1,
+                                               path_or_url1,
                                                &revision1,
                                                SVN_INVALID_REVNUM,
                                                SVN_INVALID_REVNUM,
                                                NULL, ctx, pool));
-  SVN_ERR(svn_client__get_history_as_mergeinfo(&history2, path_or_url2,
+  SVN_ERR(svn_client__get_history_as_mergeinfo(&history2,
+                                               &has_rev_zero_history2,
+                                               path_or_url2,
                                                &revision2,
                                                SVN_INVALID_REVNUM,
                                                SVN_INVALID_REVNUM,
@@ -811,6 +817,12 @@ svn_client__get_youngest_common_ancestor
         }
     }
 
+  if (!yc_path && has_rev_zero_history1 && has_rev_zero_history2)
+    {
+      yc_path = "/";
+      yc_revision = 0;
+    }
+
   *ancestor_path = yc_path;
   *ancestor_revision = yc_revision;
   return SVN_NO_ERROR;