Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/libsvn_client/merge.c  view on Meta::CPAN

                  new_segment->path = original_repos_relpath;
                  new_segment->range_start = original_revision;
                  new_segment->range_end = original_revision;
                  svn_sort__array_insert(&new_segment, segments, 0);
                }
            }
        }
    }

  /* For each range in our requested range set, try to determine the
     path(s) associated with that range.  */
  for (i = 0; i < merge_range_ts->nelts; i++)
    {
      svn_merge_range_t *range =
        APR_ARRAY_IDX(merge_range_ts, i, svn_merge_range_t *);
      apr_array_header_t *merge_sources;

      if (SVN_IS_VALID_REVNUM(trim_revision))
        {
          /* If the range predates the trim revision, discard it. */
          if (MAX(range->start, range->end) < trim_revision)
            continue;

          /* If the range overlaps the trim revision, trim it. */
          if (range->start < trim_revision)
            range->start = trim_revision;
          if (range->end < trim_revision)
            range->end = trim_revision;
        }

      /* Copy the resulting merge sources into master list thereof. */
      SVN_ERR(combine_range_with_segments(&merge_sources, range,
                                          segments, source_loc,
                                          result_pool));
      apr_array_cat(*merge_sources_p, merge_sources);
    }

  return SVN_NO_ERROR;
}

/* Determine the normalized ranges to merge from a given line of history.

   Calculate the result by intersecting the list of location segments at
   which SOURCE_LOC existed along its line of history with the requested
   revision ranges in RANGES_TO_MERGE.  RANGES_TO_MERGE is an array of
   (svn_opt_revision_range_t *) revision ranges.  Use SOURCE_PATH_OR_URL to
   resolve any WC-relative revision specifiers (such as 'base') in
   RANGES_TO_MERGE.

   Set *MERGE_SOURCES_P to an array of merge_source_t * objects, each
   describing a normalized range of revisions to be merged from the line
   history of SOURCE_LOC.  Order the objects from oldest to youngest.

   RA_SESSION is an RA session open to the repository of SOURCE_LOC; it may
   be temporarily reparented within this function.  Use RA_SESSION to find
   the location segments along the line of history of SOURCE_LOC.

   Allocate MERGE_SOURCES_P and its contents in RESULT_POOL.

   See `MERGEINFO MERGE SOURCE NORMALIZATION' for more on the
   background of this function.
*/
static svn_error_t *
normalize_merge_sources(apr_array_header_t **merge_sources_p,
                        const char *source_path_or_url,
                        const svn_client__pathrev_t *source_loc,
                        const apr_array_header_t *ranges_to_merge,
                        svn_ra_session_t *ra_session,
                        svn_client_ctx_t *ctx,
                        apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool)
{
  const char *source_abspath_or_url;
  svn_revnum_t youngest_rev = SVN_INVALID_REVNUM;
  svn_rangelist_t *merge_range_ts;
  int i;
  apr_pool_t *iterpool = svn_pool_create(scratch_pool);

  if(!svn_path_is_url(source_path_or_url))
    SVN_ERR(svn_dirent_get_absolute(&source_abspath_or_url, source_path_or_url,
                                    scratch_pool));
  else
    source_abspath_or_url = source_path_or_url;

  /* Create a list to hold svn_merge_range_t's. */
  merge_range_ts = apr_array_make(scratch_pool, ranges_to_merge->nelts,
                                  sizeof(svn_merge_range_t *));

  for (i = 0; i < ranges_to_merge->nelts; i++)
    {
      svn_opt_revision_range_t *range
        = APR_ARRAY_IDX(ranges_to_merge, i, svn_opt_revision_range_t *);
      svn_merge_range_t mrange;

      svn_pool_clear(iterpool);

      /* Resolve revisions to real numbers, validating as we go. */
      if ((range->start.kind == svn_opt_revision_unspecified)
          || (range->end.kind == svn_opt_revision_unspecified))
        return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL,
                                _("Not all required revisions are specified"));

      SVN_ERR(svn_client__get_revision_number(&mrange.start, &youngest_rev,
                                              ctx->wc_ctx,
                                              source_abspath_or_url,
                                              ra_session, &range->start,
                                              iterpool));
      SVN_ERR(svn_client__get_revision_number(&mrange.end, &youngest_rev,
                                              ctx->wc_ctx,
                                              source_abspath_or_url,
                                              ra_session, &range->end,
                                              iterpool));

      /* If this isn't a no-op range... */
      if (mrange.start != mrange.end)
        {
          /* ...then add it to the list. */
          mrange.inheritable = TRUE;
          APR_ARRAY_PUSH(merge_range_ts, svn_merge_range_t *)
            = svn_merge_range_dup(&mrange, scratch_pool);
        }



( run in 0.610 second using v1.01-cache-2.11-cpan-fe3c2283af0 )