summaryrefslogtreecommitdiff
path: root/subversion/libsvn_client/log.c
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-08-05 16:22:51 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-08-05 16:22:51 +0000
commitcf46733632c7279a9fd0fe6ce26f9185a4ae82a9 (patch)
treeda27775a2161723ef342e91af41a8b51fedef405 /subversion/libsvn_client/log.c
parentbb0ef45f7c46b0ae221b26265ef98a768c33f820 (diff)
downloadsubversion-tarball-subversion-1.9.7.tar.gz
Diffstat (limited to 'subversion/libsvn_client/log.c')
-rw-r--r--subversion/libsvn_client/log.c58
1 files changed, 48 insertions, 10 deletions
diff --git a/subversion/libsvn_client/log.c b/subversion/libsvn_client/log.c
index 9196155..adaee61 100644
--- a/subversion/libsvn_client/log.c
+++ b/subversion/libsvn_client/log.c
@@ -96,6 +96,7 @@ svn_client__get_copy_source(const char **original_repos_relpath,
svn_revnum_t *original_revision,
const char *path_or_url,
const svn_opt_revision_t *revision,
+ svn_ra_session_t *ra_session,
svn_client_ctx_t *ctx,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
@@ -103,18 +104,50 @@ svn_client__get_copy_source(const char **original_repos_relpath,
svn_error_t *err;
copyfrom_info_t copyfrom_info = { 0 };
apr_pool_t *sesspool = svn_pool_create(scratch_pool);
- svn_ra_session_t *ra_session;
svn_client__pathrev_t *at_loc;
+ const char *old_session_url = NULL;
copyfrom_info.is_first = TRUE;
copyfrom_info.path = NULL;
copyfrom_info.rev = SVN_INVALID_REVNUM;
copyfrom_info.pool = result_pool;
- SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &at_loc,
- path_or_url, NULL,
- revision, revision,
- ctx, sesspool));
+ if (!ra_session)
+ {
+ SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &at_loc,
+ path_or_url, NULL,
+ revision, revision,
+ ctx, sesspool));
+ }
+ else
+ {
+ const char *url;
+ if (svn_path_is_url(path_or_url))
+ url = path_or_url;
+ else
+ {
+ SVN_ERR(svn_client_url_from_path2(&url, path_or_url, ctx, sesspool,
+ sesspool));
+
+ if (! url)
+ return svn_error_createf(SVN_ERR_ENTRY_MISSING_URL, NULL,
+ _("'%s' has no URL"), path_or_url);
+ }
+
+ SVN_ERR(svn_client__ensure_ra_session_url(&old_session_url, ra_session,
+ url, sesspool));
+
+ err = svn_client__resolve_rev_and_url(&at_loc, ra_session, path_or_url,
+ revision, revision, ctx,
+ sesspool);
+
+ /* On error reparent back (and return), otherwise reparent to new
+ location */
+ SVN_ERR(svn_error_compose_create(
+ err,
+ svn_ra_reparent(ra_session, err ? old_session_url
+ : at_loc->url, sesspool)));
+ }
/* Find the copy source. Walk the location segments to find the revision
at which this node was created (copied or added). */
@@ -124,6 +157,11 @@ svn_client__get_copy_source(const char **original_repos_relpath,
copyfrom_info_receiver, &copyfrom_info,
scratch_pool);
+ if (old_session_url)
+ err = svn_error_compose_create(
+ err,
+ svn_ra_reparent(ra_session, old_session_url, sesspool));
+
svn_pool_destroy(sesspool);
if (err)
@@ -265,7 +303,7 @@ limit_receiver(void *baton, svn_log_entry_t *log_entry, apr_pool_t *pool)
The limitations on TARGETS specified by svn_client_log5 are enforced here.
So TARGETS can only contain a single WC path or a URL and zero or more
- relative paths -- anything else will raise an error.
+ relative paths -- anything else will raise an error.
PEG_REVISION, TARGETS, and CTX are as per svn_client_log5.
@@ -604,7 +642,7 @@ run_ra_get_log(apr_array_header_t *revision_ranges,
apr_array_header_t *log_segments,
svn_client__pathrev_t *actual_loc,
svn_ra_session_t *ra_session,
- /* The following are as per svn_client_log5. */
+ /* The following are as per svn_client_log5. */
const apr_array_header_t *targets,
int limit,
svn_boolean_t discover_changed_paths,
@@ -723,7 +761,7 @@ run_ra_get_log(apr_array_header_t *revision_ranges,
So to be safe we handle that case. */
if (matching_segment == NULL)
continue;
-
+
/* A segment with a NULL path means there is gap in the history.
We'll just proceed and let svn_ra_get_log2 fail with a useful
error...*/
@@ -905,8 +943,8 @@ svn_client_log5(const apr_array_header_t *targets,
SVN_ERR(run_ra_get_log(revision_ranges, relative_targets, log_segments,
actual_loc, ra_session, targets, limit,
discover_changed_paths, strict_node_history,
- include_merged_revisions, revprops, real_receiver,
- real_receiver_baton, ctx, pool));
+ include_merged_revisions, revprops,
+ real_receiver, real_receiver_baton, ctx, pool));
return SVN_NO_ERROR;
}