You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2015/01/09 14:56:44 UTC
svn commit: r1650531 - /subversion/trunk/subversion/libsvn_client/log.c
Author: stsp
Date: Fri Jan 9 13:56:43 2015
New Revision: 1650531
URL: http://svn.apache.org/r1650531
Log:
Fix a redirect handling bug in 'svn log' over HTTP.
A server config with:
RedirectMatch permanent ^/svn/repoOLD$ /svn/repoNEW
RedirectMatch permanent ^/svn/repoOLD/(.*)$ /svn/repoNEW/$1
would result in the following error:
$ svn log http://localhost:8081/svn/repoOLD
Redirecting to URL 'http://localhost:8081/svn/repoNEW':
subversion/svn/log-cmd.c:876,
subversion/libsvn_client/log.c:899,
subversion/libsvn_client/ra.c:576,
subversion/libsvn_ra/ra_loader.c:588: (apr_err=SVN_ERR_RA_ILLEGAL_URL)
svn: E170000: 'http://localhost:8081/svn/repoOLD' isn't in the same repository as 'http://localhost:8081/svn/repoNEW'
With this fix 'svn log' follows the redirect as expected.
* subversion/libsvn_client/log.c
(svn_client_log5): Don't ignore corrected RA session location returned by
svn_client__ra_session_from_path2().
Modified:
subversion/trunk/subversion/libsvn_client/log.c
Modified: subversion/trunk/subversion/libsvn_client/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/log.c?rev=1650531&r1=1650530&r2=1650531&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/log.c (original)
+++ subversion/trunk/subversion/libsvn_client/log.c Fri Jan 9 13:56:43 2015
@@ -852,10 +852,12 @@ svn_client_log5(const apr_array_header_t
svn_ra_session_t *ra_session;
const char *old_session_url;
const char *ra_target;
+ const char *path_or_url;
svn_opt_revision_t youngest_opt_rev;
svn_revnum_t youngest_rev;
svn_revnum_t oldest_rev;
svn_opt_revision_t peg_rev;
+ svn_client__pathrev_t *ra_session_loc;
svn_client__pathrev_t *actual_loc;
apr_array_header_t *log_segments;
apr_array_header_t *revision_ranges;
@@ -875,7 +877,7 @@ svn_client_log5(const apr_array_header_t
SVN_ERR(resolve_log_targets(&relative_targets, &ra_target, &peg_rev,
targets, ctx, pool, pool));
- SVN_ERR(svn_client__ra_session_from_path2(&ra_session, NULL,
+ SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &ra_session_loc,
ra_target, NULL, &peg_rev, &peg_rev,
ctx, pool));
@@ -889,11 +891,22 @@ svn_client_log5(const apr_array_header_t
opt_rev_ranges, &peg_rev,
ctx, pool, pool));
+ /* For some peg revisions we must resolve revision and url via a local path
+ so use the original RA_TARGET. For others, use the potentially corrected
+ (redirected) ra session URL. */
+ if (peg_rev.kind == svn_opt_revision_previous ||
+ peg_rev.kind == svn_opt_revision_base ||
+ peg_rev.kind == svn_opt_revision_committed ||
+ peg_rev.kind == svn_opt_revision_working)
+ path_or_url = ra_target;
+ else
+ path_or_url = ra_session_loc->url;
+
/* Make ACTUAL_LOC and RA_SESSION point to the youngest operative rev. */
youngest_opt_rev.kind = svn_opt_revision_number;
youngest_opt_rev.value.number = youngest_rev;
SVN_ERR(svn_client__resolve_rev_and_url(&actual_loc, ra_session,
- ra_target, &peg_rev,
+ path_or_url, &peg_rev,
&youngest_opt_rev, ctx, pool));
SVN_ERR(svn_client__ensure_ra_session_url(&old_session_url, ra_session,
actual_loc->url, pool));