subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1306211 - /subversion/trunk/subversion/libsvn_client/merge.c
Date Wed, 28 Mar 2012 08:34:04 GMT
Author: julianfoad
Date: Wed Mar 28 08:34:04 2012
New Revision: 1306211

URL: http://svn.apache.org/viewvc?rev=1306211&view=rev
Log:
In the merge code, never leave a repo_location_t's repository root fields as
NULL.

* subversion/libsvn_client/merge.c
  (repo_location_create): Don't allow the incoming repository root fields to
    be NULL.
  (combine_range_with_segments): Take a location instead of just a URL, and
    use it to fill in the repository root fields.
  (find_base_on_source): Fill in the repository root fields.
  (make_conflict_versions, normalize_merge_sources_internal): Use the stored
    root URL instead of asking the session.

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=1306211&r1=1306210&r2=1306211&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Wed Mar 28 08:34:04 2012
@@ -333,18 +333,8 @@ repo_location_create(const char *repos_r
 {
   repo_location_t *loc = apr_palloc(result_pool, sizeof(*loc));
 
-  /* ### This 'if' is because 'repos_*' currently can be null, at least in a
-   * repo_location_t inside a merge_source_t. */
-  if (repos_root_url && repos_uuid)
-    {
-      loc->repos_root_url = apr_pstrdup(result_pool, repos_root_url);
-      loc->repos_uuid = apr_pstrdup(result_pool, repos_uuid);
-    }
-  else
-    {
-      loc->repos_root_url = NULL;
-      loc->repos_uuid = NULL;
-    }
+  loc->repos_root_url = apr_pstrdup(result_pool, repos_root_url);
+  loc->repos_uuid = apr_pstrdup(result_pool, repos_uuid);
   loc->rev = rev;
   loc->url = apr_pstrdup(result_pool, url);
   return loc;
@@ -630,13 +620,9 @@ make_conflict_versions(const svn_wc_conf
                        svn_node_kind_t node_kind,
                        merge_cmd_baton_t *merge_b)
 {
-  const char *src_repos_url;  /* root URL of source repository */
   const char *left_url;
   const char *right_url;
 
-  SVN_ERR(svn_ra_get_repos_root2(merge_b->ra_session1, &src_repos_url,
-                                 merge_b->pool));
-
   /* Construct the source URLs of the victim. */
   {
     const char *child = svn_dirent_skip_ancestor(merge_b->target->abspath,
@@ -649,13 +635,17 @@ make_conflict_versions(const svn_wc_conf
   }
 
   *left = svn_wc_conflict_version_create(
-            src_repos_url,
-            svn_uri_skip_ancestor(src_repos_url, left_url, merge_b->pool),
+            merge_b->merge_source.loc1->repos_root_url,
+            svn_uri_skip_ancestor(
+              merge_b->merge_source.loc1->repos_root_url,
+              left_url, merge_b->pool),
             merge_b->merge_source.loc1->rev, node_kind, merge_b->pool);
 
   *right = svn_wc_conflict_version_create(
-             src_repos_url,
-             svn_uri_skip_ancestor(src_repos_url, right_url, merge_b->pool),
+             merge_b->merge_source.loc2->repos_root_url,
+             svn_uri_skip_ancestor(
+               merge_b->merge_source.loc2->repos_root_url,
+               right_url, merge_b->pool),
              merge_b->merge_source.loc2->rev, node_kind, merge_b->pool);
 
   return SVN_NO_ERROR;
@@ -6321,7 +6311,7 @@ compare_merge_source_ts(const void *a,
 
 /* Set *MERGE_SOURCE_TS_P to a list of merge sources generated by
    slicing history location SEGMENTS with a given requested merge
-   RANGE.  Use SOURCE_ROOT_URL for full source URL calculation.
+   RANGE.  Use SOURCE_LOC for full source URL calculation.
 
    Order the merge sources in *MERGE_SOURCE_TS_P from oldest to
    youngest. */
@@ -6329,7 +6319,7 @@ static svn_error_t *
 combine_range_with_segments(apr_array_header_t **merge_source_ts_p,
                             const svn_merge_range_t *range,
                             const apr_array_header_t *segments,
-                            const char *source_root_url,
+                            const repo_location_t *source_loc,
                             apr_pool_t *pool)
 {
   apr_array_header_t *merge_source_ts =
@@ -6343,7 +6333,7 @@ combine_range_with_segments(apr_array_he
     {
       svn_location_segment_t *segment =
         APR_ARRAY_IDX(segments, i, svn_location_segment_t *);
-      repo_location_t loc1 = { 0 }, loc2 = { 0 };
+      repo_location_t loc1, loc2;
       merge_source_t *merge_source;
       const char *path1 = NULL;
       svn_revnum_t rev1;
@@ -6391,12 +6381,16 @@ combine_range_with_segments(apr_array_he
         continue;
 
       /* Build our merge source structure. */
-      loc1.url = svn_path_url_add_component2(source_root_url, path1,
-                                             pool);
-      loc2.url = svn_path_url_add_component2(source_root_url, segment->path,
-                                             pool);
+      loc1.repos_root_url = source_loc->repos_root_url;
+      loc1.repos_uuid = source_loc->repos_uuid;
       loc1.rev = rev1;
+      loc1.url = svn_path_url_add_component2(source_loc->repos_root_url,
+                                             path1, pool);
+      loc2.repos_root_url = source_loc->repos_root_url;
+      loc2.repos_uuid = source_loc->repos_uuid;
       loc2.rev = MIN(segment->range_end, maxrev);
+      loc2.url = svn_path_url_add_component2(source_loc->repos_root_url,
+                                             segment->path, pool);
       merge_source = merge_source_create(&loc1, &loc2, pool);
 
       /* If this is subtractive, reverse the whole calculation. */
@@ -6439,7 +6433,6 @@ normalize_merge_sources_internal(apr_arr
   svn_revnum_t source_peg_revnum = source_loc->rev;
   svn_revnum_t oldest_requested, youngest_requested;
   svn_revnum_t trim_revision = SVN_INVALID_REVNUM;
-  const char *source_root_url;
   apr_array_header_t *segments;
   int i;
 
@@ -6478,8 +6471,6 @@ normalize_merge_sources_internal(apr_arr
                                               oldest_requested,
                                               ctx, result_pool));
 
-  SVN_ERR(svn_ra_get_repos_root2(ra_session, &source_root_url, scratch_pool));
-
   /* See if we fetched enough history to do the job.  "Surely we did,"
      you say.  "After all, we covered the entire requested merge
      range."  Yes, that's true, but if our first segment doesn't
@@ -6523,9 +6514,9 @@ normalize_merge_sources_internal(apr_arr
               range_start_rev.kind = svn_opt_revision_number;
               range_start_rev.value.number = segment2->range_start;
 
-              segment_url = svn_path_url_add_component2(source_root_url,
-                                                        segment2->path,
-                                                        scratch_pool);
+              segment_url = svn_path_url_add_component2(
+                              source_loc->repos_root_url, segment2->path,
+                              scratch_pool);
               SVN_ERR(svn_client__get_copy_source(segment_url,
                                                   &range_start_rev,
                                                   &copyfrom_path,
@@ -6576,7 +6567,7 @@ normalize_merge_sources_internal(apr_arr
 
       /* Copy the resulting merge sources into master list thereof. */
       SVN_ERR(combine_range_with_segments(&merge_sources, range,
-                                          segments, source_root_url,
+                                          segments, source_loc,
                                           result_pool));
       apr_array_cat(*merge_sources_p, merge_sources);
     }
@@ -11067,7 +11058,7 @@ find_base_on_source(repo_location_t **ba
   svn_mergeinfo_t target_mergeinfo;
   svn_client__merge_path_t *merge_target;
   svn_boolean_t inherited;
-  repo_location_t loc1 = { 0 };
+  repo_location_t loc1;
   merge_source_t source;
   svn_merge_range_t *r;
 
@@ -11085,6 +11076,8 @@ find_base_on_source(repo_location_t **ba
   /* In order to find the first unmerged change in the source, set
    * MERGE_TARGET->remaining_ranges to the ranges left to merge,
    * and look at the start revision of the first such range. */
+  loc1.repos_root_url = s_t->source->repos_root_url;
+  loc1.repos_uuid = s_t->source->repos_uuid;
   loc1.url = s_t->source->url;  /* ### WRONG: need historical URL/REV */
   loc1.rev = 1;
   source.loc1 = &loc1;



Mime
View raw message