You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2010/08/11 03:38:42 UTC

svn commit: r984280 - in /subversion/trunk: ./ subversion/include/ subversion/libsvn_client/ subversion/libsvn_ra/ subversion/libsvn_ra_local/ subversion/libsvn_ra_neon/ subversion/libsvn_ra_serf/ subversion/libsvn_ra_svn/ subversion/svn/ subversion/te...

Author: cmpilato
Date: Wed Aug 11 01:38:40 2010
New Revision: 984280

URL: http://svn.apache.org/viewvc?rev=984280&view=rev
Log:
Reintegrate the issue-2779-dev branch.  Permanent redirect responses
from an HTTP server now cause the client -- in particular
circumstances -- to automatically follow the redirect.

NOTE:  The test suite changes brought in by this merge require
modifications to developers' httpd.conf files.  So if you see the
redirect_tests.py all failing, make sure you've updated your Apache
configuration per the instructions in the
subversion/tests/cmdline/README file.

Added:
    subversion/trunk/BRANCH-README
      - copied unchanged from r984198, subversion/branches/issue-2779-dev/BRANCH-README
    subversion/trunk/subversion/tests/cmdline/redirect_tests.py
      - copied unchanged from r984198, subversion/branches/issue-2779-dev/subversion/tests/cmdline/redirect_tests.py
Modified:
    subversion/trunk/   (props changed)
    subversion/trunk/subversion/include/svn_error_codes.h
    subversion/trunk/subversion/include/svn_ra.h
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_client/add.c
    subversion/trunk/subversion/libsvn_client/client.h
    subversion/trunk/subversion/libsvn_client/commit.c
    subversion/trunk/subversion/libsvn_client/copy.c
    subversion/trunk/subversion/libsvn_client/delete.c
    subversion/trunk/subversion/libsvn_client/diff.c
    subversion/trunk/subversion/libsvn_client/externals.c
    subversion/trunk/subversion/libsvn_client/info.c
    subversion/trunk/subversion/libsvn_client/list.c
    subversion/trunk/subversion/libsvn_client/locking_commands.c
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/libsvn_client/mergeinfo.c
    subversion/trunk/subversion/libsvn_client/prop_commands.c
    subversion/trunk/subversion/libsvn_client/ra.c
    subversion/trunk/subversion/libsvn_client/relocate.c
    subversion/trunk/subversion/libsvn_client/status.c
    subversion/trunk/subversion/libsvn_client/update.c
    subversion/trunk/subversion/libsvn_client/url.c
    subversion/trunk/subversion/libsvn_ra/deprecated.c
    subversion/trunk/subversion/libsvn_ra/ra_loader.c
    subversion/trunk/subversion/libsvn_ra/ra_loader.h
    subversion/trunk/subversion/libsvn_ra/wrapper_template.h
    subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c
    subversion/trunk/subversion/libsvn_ra_neon/fetch.c
    subversion/trunk/subversion/libsvn_ra_neon/options.c
    subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h
    subversion/trunk/subversion/libsvn_ra_neon/session.c
    subversion/trunk/subversion/libsvn_ra_neon/util.c
    subversion/trunk/subversion/libsvn_ra_serf/options.c
    subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
    subversion/trunk/subversion/libsvn_ra_serf/serf.c
    subversion/trunk/subversion/libsvn_ra_serf/util.c
    subversion/trunk/subversion/libsvn_ra_svn/client.c
    subversion/trunk/subversion/svn/notify.c
    subversion/trunk/subversion/tests/cmdline/README
    subversion/trunk/subversion/tests/cmdline/davautocheck.sh
    subversion/trunk/subversion/tests/cmdline/svntest/actions.py
    subversion/trunk/subversion/tests/cmdline/svntest/main.py
    subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py

Propchange: subversion/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 11 01:38:40 2010
@@ -10,6 +10,7 @@
 /subversion/branches/gnome-keyring:870558-871410
 /subversion/branches/http-protocol-v2:874395-876041
 /subversion/branches/in-memory-cache:869829-871452
+/subversion/branches/issue-2779-dev:965496-984198
 /subversion/branches/issue-2843-dev:871432-874179
 /subversion/branches/issue-3000:871713,871716-871719,871721-871726,871728,871734
 /subversion/branches/issue-3067-deleted-subtrees:873375-874084

Modified: subversion/trunk/subversion/include/svn_error_codes.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_error_codes.h?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_error_codes.h (original)
+++ subversion/trunk/subversion/include/svn_error_codes.h Wed Aug 11 01:38:40 2010
@@ -837,6 +837,11 @@ SVN_ERROR_START
              SVN_ERR_RA_CATEGORY_START + 10,
              "Repository root URL does not match expected root URL")
 
+  /** @since New in 1.7. */
+  SVN_ERRDEF(SVN_ERR_RA_SESSION_URL_MISMATCH,
+             SVN_ERR_RA_CATEGORY_START + 11,
+             "Session URL does not match expected session URL")
+
   /* ra_dav errors */
 
   SVN_ERRDEF(SVN_ERR_RA_DAV_SOCK_INIT,
@@ -1165,6 +1170,11 @@ SVN_ERROR_START
              SVN_ERR_CLIENT_CATEGORY_START + 18,
              "Invalid path component strip count specified")
 
+  /** @since New in 1.7. */
+  SVN_ERRDEF(SVN_ERR_CLIENT_CYCLE_DETECTED,
+             SVN_ERR_CLIENT_CATEGORY_START + 19,
+             "Detected a cycle while processing the operation")
+
   /* misc errors */
 
   SVN_ERRDEF(SVN_ERR_BASE,

Modified: subversion/trunk/subversion/include/svn_ra.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_ra.h?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_ra.h (original)
+++ subversion/trunk/subversion/include/svn_ra.h Wed Aug 11 01:38:40 2010
@@ -65,7 +65,7 @@ svn_ra_version(void);
  * @a close_baton as appropriate.
  *
  * @a path is relative to the "root" of the session, defined by the
- * @a repos_URL passed to svn_ra_open3() vtable call.
+ * @a repos_URL passed to svn_ra_open4() vtable call.
  *
  * @a name is the name of the property to fetch. If the property is present,
  * then it is returned in @a value. Otherwise, @a *value is set to @c NULL.
@@ -294,7 +294,7 @@ typedef struct svn_ra_reporter3_t
    * implementor should assume the directory has no entries or props.
    *
    * This will *override* any previous set_path() calls made on parent
-   * paths.  @a path is relative to the URL specified in svn_ra_open3().
+   * paths.  @a path is relative to the URL specified in svn_ra_open4().
    *
    * If @a lock_token is non-NULL, it is the lock token for @a path in the WC.
    *
@@ -445,7 +445,7 @@ typedef struct svn_ra_reporter_t
 /** A collection of callbacks implemented by libsvn_client which allows
  * an RA layer to "pull" information from the client application, or
  * possibly store information.  libsvn_client passes this vtable to
- * svn_ra_open3().
+ * svn_ra_open4().
  *
  * Each routine takes a @a callback_baton originally provided with the
  * vtable.
@@ -580,8 +580,19 @@ svn_ra_create_callbacks(svn_ra_callbacks
 typedef struct svn_ra_session_t svn_ra_session_t;
 
 /**
- * Open a repository session to @a repos_URL.  Return an opaque object
- * representing this session in @a *session_p, allocated in @a pool.
+ * Open a repository access session to the repository at @a repos_URL,
+ * or inform the caller regarding a correct URL by which to access
+ * that repository.
+ *
+ * If @a repos_URL can be used successfully to access the repository,
+ * set @a *session_p to an opaque object representing a repository
+ * session for the repository and (if @a corrected_url is non-NULL)
+ * set @a *corrected_url to NULL.  If there's a better URL that the
+ * caller should try and @a corrected_url is non-NULL, set
+ * @a *session_p to NULL and @a *corrected_url to the corrected URL.  If
+ * there's a better URL that the caller should try, and @a
+ * corrected_url is NULL, return an #SVN_ERR_RA_SESSION_URL_MISMATCH
+ * error.  Allocate all returned items in @a pool.
  *
  * Return @c SVN_ERR_RA_UUID_MISMATCH if @a uuid is non-NULL and not equal
  * to the UUID of the repository at @c repos_URL.
@@ -598,8 +609,25 @@ typedef struct svn_ra_session_t svn_ra_s
  *
  * @see svn_client_open_ra_session().
  *
+ * @since New in 1.7.
+ */
+svn_error_t *
+svn_ra_open4(svn_ra_session_t **session_p,
+             const char **corrected_url,
+             const char *repos_URL,
+             const char *uuid,
+             const svn_ra_callbacks2_t *callbacks,
+             void *callback_baton,
+             apr_hash_t *config,
+             apr_pool_t *pool);
+
+/** Similar to svn_ra_open4(), but with @a corrected_url always passed
+ * as @c NULL.
+ *
  * @since New in 1.5.
+ * @deprecated Provided for backward compatibility with the 1.6 API.
  */
+SVN_DEPRECATED
 svn_error_t *
 svn_ra_open3(svn_ra_session_t **session_p,
              const char *repos_URL,
@@ -1568,8 +1596,9 @@ svn_ra_get_location_segments(svn_ra_sess
  * empty file.  In the following calls, the delta will be against the
  * fulltext contents for the previous call.
  *
- * If @a include_merged_revisions is TRUE, revisions which a included as a
- * result of a merge between @a start and @a end will be included.
+ * If @a include_merged_revisions is TRUE, revisions which are
+ * included as a result of a merge between @a start and @a end will be
+ * included.
  *
  * @note This functionality is not available in pre-1.1 servers.  If the
  * server doesn't implement it, an alternative (but much slower)

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Wed Aug 11 01:38:40 2010
@@ -1086,6 +1086,11 @@ typedef enum svn_wc_notify_action_t
    * @since New in 1.7. */
   svn_wc_notify_patch_hunk_already_applied,
 
+  /** The server has instructed the client to follow a URL
+   * redirection.
+   * @since New in 1.7. */
+  svn_wc_notify_url_redirect
+
 } svn_wc_notify_action_t;
 
 

Modified: subversion/trunk/subversion/libsvn_client/add.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/add.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/add.c (original)
+++ subversion/trunk/subversion/libsvn_client/add.c Wed Aug 11 01:38:40 2010
@@ -688,9 +688,9 @@ mkdir_urls(const apr_array_header_t *url
       const char *first_url = APR_ARRAY_IDX(urls, 0, const char *);
       apr_pool_t *iterpool = svn_pool_create(pool);
 
-      SVN_ERR(svn_client__open_ra_session_internal(&ra_session, first_url,
-                                                   NULL, NULL, FALSE,
-                                                   TRUE, ctx, pool));
+      SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL,
+                                                   first_url, NULL, NULL,
+                                                   FALSE, TRUE, ctx, pool));
 
       for (i = 0; i < urls->nelts; i++)
         {
@@ -790,8 +790,9 @@ mkdir_urls(const apr_array_header_t *url
   /* Open an RA session for the URL. Note that we don't have a local
      directory, nor a place to put temp files. */
   if (!ra_session)
-    SVN_ERR(svn_client__open_ra_session_internal(&ra_session, common, NULL,
-                                                 NULL, FALSE, TRUE, ctx, pool));
+    SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, common,
+                                                 NULL, NULL, FALSE, TRUE,
+                                                 ctx, pool));
 
   /* URI-decode each target. */
   for (i = 0; i < targets->nelts; i++)

Modified: subversion/trunk/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Wed Aug 11 01:38:40 2010
@@ -349,7 +349,9 @@ svn_client__default_walker_error_handler
 #define SVN_CLIENT__HAS_LOG_MSG_FUNC(ctx) \
         ((ctx)->log_msg_func3 || (ctx)->log_msg_func2 || (ctx)->log_msg_func)
 
-/* Open an RA session, returning it in *RA_SESSION.
+/* Open an RA session, returning it in *RA_SESSION or a corrected URL
+   in *CORRECTED_URL.  (This function mirrors svn_ra_open4(), which
+   see, regarding the interpretation and handling of these two parameters.)
 
    The root of the session is specified by BASE_URL and BASE_DIR.
 
@@ -375,6 +377,7 @@ svn_client__default_walker_error_handler
    avoid confusion with the public API svn_client_open_ra_session(). */
 svn_error_t *
 svn_client__open_ra_session_internal(svn_ra_session_t **ra_session,
+                                     const char **corrected_url,
                                      const char *base_url,
                                      const char *base_dir_abspath,
                                      const apr_array_header_t *commit_items,

Modified: subversion/trunk/subversion/libsvn_client/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit.c Wed Aug 11 01:38:40 2010
@@ -637,7 +637,7 @@ get_ra_editor(svn_ra_session_t **ra_sess
   apr_hash_t *commit_revprops;
 
   /* Open an RA session to URL. */
-  SVN_ERR(svn_client__open_ra_session_internal(ra_session, base_url,
+  SVN_ERR(svn_client__open_ra_session_internal(ra_session, NULL, base_url,
                                                base_dir_abspath, commit_items,
                                                is_commit, !is_commit,
                                                ctx, pool));

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Wed Aug 11 01:38:40 2010
@@ -750,7 +750,7 @@ repos_to_repos_copy(const apr_array_head
      be verifying that every one of our copy source and destination
      URLs is or is beneath this sucker's repository root URL as a form
      of a cheap(ish) sanity check.  */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session,
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL,
                                                first_pair->src_abspath_or_url,
                                                NULL, NULL, FALSE, TRUE,
                                                ctx, pool));
@@ -1212,7 +1212,7 @@ wc_to_repos_copy(const apr_array_header_
     }
 
   SVN_ERR(svn_dirent_get_absolute(&top_src_abspath, top_src_path, pool));
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, top_dst_url,
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, top_dst_url,
                                                top_src_abspath, NULL, TRUE,
                                                TRUE, ctx, pool));
 
@@ -1383,7 +1383,7 @@ wc_to_repos_copy(const apr_array_header_
                                             commit_items, pool));
 
   /* Open an RA session to DST_URL. */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, top_dst_url,
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, top_dst_url,
                                                NULL, commit_items,
                                                FALSE, FALSE, ctx, pool));
 
@@ -1770,8 +1770,9 @@ repos_to_wc_copy(const apr_array_header_
   /* Open a repository session to the longest common src ancestor.  We do not
      (yet) have a working copy, so we don't have a corresponding path and
      tempfiles cannot go into the admin area. */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, top_src_url, NULL,
-                                               NULL, FALSE, TRUE, ctx, pool));
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, top_src_url,
+                                               NULL, NULL, FALSE, TRUE,
+                                               ctx, pool));
 
   /* Pass null for the path, to ensure error if trying to get a
      revision based on the working copy.  */

Modified: subversion/trunk/subversion/libsvn_client/delete.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/delete.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/delete.c (original)
+++ subversion/trunk/subversion/libsvn_client/delete.c Wed Aug 11 01:38:40 2010
@@ -214,9 +214,9 @@ delete_urls(const apr_array_header_t *pa
          session.  */
       if (! ra_session)
         {
-          SVN_ERR(svn_client__open_ra_session_internal(&ra_session, item_url,
-                                                       NULL, NULL, FALSE,
-                                                       TRUE, ctx, pool));
+          SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL,
+                                                       item_url, NULL, NULL,
+                                                       FALSE, TRUE, ctx, pool));
         }
       else
         {

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Wed Aug 11 01:38:40 2010
@@ -1375,7 +1375,7 @@ diff_prepare_repos_repos(const struct di
   if (strcmp(drr->url2, params->path2) != 0)
     drr->base_path = params->path2;
 
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, drr->url2,
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, drr->url2,
                                                NULL, NULL, FALSE,
                                                TRUE, ctx, pool));
 
@@ -1593,9 +1593,9 @@ diff_repos_repos(const struct diff_param
   /* Now, we open an extra RA session to the correct anchor
      location for URL1.  This is used during the editor calls to fetch file
      contents.  */
-  SVN_ERR(svn_client__open_ra_session_internal(&extra_ra_session, drr.anchor1,
-                                               NULL, NULL, FALSE, TRUE, ctx,
-                                               pool));
+  SVN_ERR(svn_client__open_ra_session_internal(&extra_ra_session, NULL,
+                                               drr.anchor1, NULL, NULL, FALSE,
+                                               TRUE, ctx, pool));
 
   /* Set up the repos_diff editor on BASE_PATH, if available.
      Otherwise, we just use "". */
@@ -1715,7 +1715,7 @@ diff_repos_wc(const char *path1,
     }
 
   /* Establish RA session to path2's anchor */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, anchor_url,
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, anchor_url,
                                                NULL, NULL, FALSE, TRUE,
                                                ctx, pool));
 
@@ -1851,9 +1851,9 @@ diff_summarize_repos_repos(const struct 
 
   /* Now, we open an extra RA session to the correct anchor
      location for URL1.  This is used to get the kind of deleted paths.  */
-  SVN_ERR(svn_client__open_ra_session_internal(&extra_ra_session, drr.anchor1,
-                                               NULL, NULL, FALSE, TRUE,
-                                               ctx, pool));
+  SVN_ERR(svn_client__open_ra_session_internal(&extra_ra_session, NULL,
+                                               drr.anchor1, NULL, NULL, FALSE,
+                                               TRUE, ctx, pool));
 
   /* Set up the repos_diff editor. */
   SVN_ERR(svn_client__get_diff_summarize_editor

Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Wed Aug 11 01:38:40 2010
@@ -224,8 +224,8 @@ switch_dir_external(const char *path,
 
                   /* Get the repos root of the new URL. */
                   SVN_ERR(svn_client__open_ra_session_internal
-                          (&ra_session, url, NULL, NULL, FALSE, TRUE,
-                           ctx, subpool));
+                          (&ra_session, NULL, url, NULL, NULL,
+                           FALSE, TRUE, ctx, subpool));
                   SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root,
                                                  subpool));
 

Modified: subversion/trunk/subversion/libsvn_client/info.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/info.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/info.c (original)
+++ subversion/trunk/subversion/libsvn_client/info.c Wed Aug 11 01:38:40 2010
@@ -570,7 +570,7 @@ svn_client_info3(const char *abspath_or_
                                  url, rev);
 
       /* Open a new RA session to the item's parent. */
-      SVN_ERR(svn_client__open_ra_session_internal(&parent_ra_session,
+      SVN_ERR(svn_client__open_ra_session_internal(&parent_ra_session, NULL,
                                                    parent_url, NULL,
                                                    NULL, FALSE, TRUE,
                                                    ctx, pool));

Modified: subversion/trunk/subversion/libsvn_client/list.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/list.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/list.c (original)
+++ subversion/trunk/subversion/libsvn_client/list.c Wed Aug 11 01:38:40 2010
@@ -178,8 +178,8 @@ svn_client_list2(const char *path_or_url
               base_name = svn_path_uri_decode(base_name, pool);
 
               SVN_ERR(svn_client__open_ra_session_internal(&parent_session,
-                                                           parent_url, NULL,
-                                                           NULL, FALSE,
+                                                           NULL, parent_url,
+                                                           NULL, NULL, FALSE,
                                                            TRUE, ctx, pool));
 
               /* Get all parent's entries, no props. */

Modified: subversion/trunk/subversion/libsvn_client/locking_commands.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/locking_commands.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/locking_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/locking_commands.c Wed Aug 11 01:38:40 2010
@@ -415,8 +415,10 @@ svn_client_lock(const apr_array_header_t
   /* Open an RA session to the common parent of TARGETS. */
   if (base_dir)
     SVN_ERR(svn_dirent_get_absolute(&base_dir_abspath, base_dir, pool));
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, common_parent_url,
-                        base_dir, NULL, FALSE, FALSE, ctx, pool));
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL,
+                                               common_parent_url, base_dir,
+                                               NULL, FALSE, FALSE,
+                                               ctx, pool));
 
   cb.base_path = base_dir;
   cb.urls_to_paths = urls_to_paths;
@@ -453,8 +455,10 @@ svn_client_unlock(const apr_array_header
   /* Open an RA session. */
   if (base_dir)
     SVN_ERR(svn_dirent_get_absolute(&base_dir_abspath, base_dir, pool));
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, common_parent_url,
-                        base_dir_abspath, NULL, FALSE, FALSE, ctx, pool));
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL,
+                                               common_parent_url,
+                                               base_dir_abspath, NULL, FALSE,
+                                               FALSE, ctx, pool));
 
   /* If break_lock is not set, lock tokens are required by the server.
      If the targets were all URLs, ensure that we provide lock tokens,

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Wed Aug 11 01:38:40 2010
@@ -3395,7 +3395,7 @@ get_full_mergeinfo(svn_mergeinfo_t *reco
         }
       else
         {
-          SVN_ERR(svn_client__open_ra_session_internal(&ra_session, url,
+          SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, url,
                                                        NULL, NULL,
                                                        FALSE, TRUE,
                                                        ctx, scratch_pool));
@@ -8199,9 +8199,8 @@ ensure_ra_session_url(svn_ra_session_t *
   if (! *ra_session || (err && err->apr_err == SVN_ERR_RA_ILLEGAL_URL))
     {
       svn_error_clear(err);
-      err = svn_client__open_ra_session_internal(ra_session, url,
-                                                 NULL, NULL,
-                                                 FALSE, TRUE, ctx, pool);
+      err = svn_client__open_ra_session_internal(ra_session, NULL, url, NULL,
+                                                 NULL, FALSE, TRUE, ctx, pool);
     }
   SVN_ERR(err);
 
@@ -8735,12 +8734,12 @@ merge_locked(const char *source1,
 
   /* Open some RA sessions to our merge source sides. */
   sesspool = svn_pool_create(scratch_pool);
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session1,
-                                               URL1, NULL, NULL,
-                                               FALSE, TRUE, ctx, sesspool));
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session2,
-                                               URL2, NULL, NULL,
-                                               FALSE, TRUE, ctx, sesspool));
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session1, NULL, URL1,
+                                               NULL, NULL, FALSE, TRUE,
+                                               ctx, sesspool));
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session2, NULL, URL2,
+                                               NULL, NULL, FALSE, TRUE,
+                                               ctx, sesspool));
 
   /* Resolve revisions to real numbers. */
   SVN_ERR(svn_client__get_revision_number(&rev1, &youngest_rev, ctx->wc_ctx,
@@ -10027,13 +10026,13 @@ merge_reintegrate_locked(const char *sou
   /* Open two RA sessions, one to our source and one to our target. */
   SVN_ERR(svn_wc__node_get_url(&target_url, ctx->wc_ctx, target_abspath,
                                scratch_pool, scratch_pool));
-  SVN_ERR(svn_client__open_ra_session_internal(&target_ra_session, target_url,
-                                               NULL, NULL, FALSE, FALSE, ctx,
-                                               scratch_pool));
-  SVN_ERR(svn_client__open_ra_session_internal(&source_ra_session, url2,
-                                               NULL, NULL,
-                                               FALSE, FALSE, ctx,
-                                               scratch_pool));
+  SVN_ERR(svn_client__open_ra_session_internal(&target_ra_session, NULL,
+                                               target_url,
+                                               NULL, NULL, FALSE, FALSE,
+                                               ctx, scratch_pool));
+  SVN_ERR(svn_client__open_ra_session_internal(&source_ra_session, NULL,
+                                               url2, NULL, NULL, FALSE, FALSE,
+                                               ctx, scratch_pool));
 
   SVN_ERR(svn_client__get_revision_number(&rev2, NULL, ctx->wc_ctx,
                                           "",
@@ -10236,8 +10235,9 @@ merge_peg_locked(const char *source,
 
   /* Open an RA session to our source URL, and determine its root URL. */
   sesspool = svn_pool_create(scratch_pool);
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, URL, NULL, NULL,
-                                               FALSE, TRUE, ctx, sesspool));
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, URL, NULL,
+                                               NULL, FALSE, TRUE,
+                                               ctx, sesspool));
   SVN_ERR(svn_ra_get_repos_root2(ra_session, &source_repos_root, scratch_pool));
 
   /* Normalize our merge sources. */

Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Wed Aug 11 01:38:40 2010
@@ -616,11 +616,9 @@ svn_client__get_wc_or_repos_mergeinfo_ca
               else
                 {
                   sesspool = svn_pool_create(scratch_pool);
-                  SVN_ERR(svn_client__open_ra_session_internal(&ra_session,
-                                                               url, NULL, NULL,
-                                                               FALSE, TRUE,
-                                                               ctx,
-                                                               sesspool));
+                  SVN_ERR(svn_client__open_ra_session_internal(
+                              &ra_session, NULL, url, NULL, NULL, FALSE,
+                              TRUE, ctx, sesspool));
                 }
 
               SVN_ERR(svn_client__get_repos_mergeinfo_catalog(
@@ -725,9 +723,9 @@ svn_client__get_history_as_mergeinfo(svn
   if (session == NULL)
     {
       sesspool = svn_pool_create(pool);
-      SVN_ERR(svn_client__open_ra_session_internal(&session, url, NULL, NULL,
-                                                   FALSE, TRUE, ctx,
-                                                   sesspool));
+      SVN_ERR(svn_client__open_ra_session_internal(&session, NULL, url, NULL,
+                                                   NULL, FALSE, TRUE,
+                                                   ctx, sesspool));
     }
 
   /* Fetch the location segments for our URL@PEG_REVNUM. */
@@ -1031,9 +1029,10 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
       svn_mergeinfo_catalog_t tmp_catalog;
 
       SVN_ERR(svn_dirent_get_absolute(&local_abspath, "", scratch_pool));
-      SVN_ERR(svn_client__open_ra_session_internal(&ra_session, path_or_url,
-                                                   NULL, NULL, FALSE,
-                                                   TRUE, ctx, scratch_pool));
+      SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL,
+                                                   path_or_url, NULL, NULL,
+                                                   FALSE, TRUE, ctx,
+                                                   scratch_pool));
       SVN_ERR(svn_client__get_revision_number(&rev, NULL, ctx->wc_ctx,
                                               local_abspath, ra_session,
                                               &peg_rev, scratch_pool));
@@ -1081,9 +1080,9 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
       svn_boolean_t indirect;
 
       /* Check server Merge Tracking capability. */
-      SVN_ERR(svn_client__open_ra_session_internal(&ra_session, url,
-                                                   NULL, NULL, FALSE,
-                                                   TRUE, ctx, scratch_pool));
+      SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, url,
+                                                   NULL, NULL, FALSE, TRUE,
+                                                   ctx, scratch_pool));
       SVN_ERR(svn_ra__assert_mergeinfo_capable_server(ra_session, path_or_url,
                                                       scratch_pool));
 

Modified: subversion/trunk/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/prop_commands.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/prop_commands.c Wed Aug 11 01:38:40 2010
@@ -215,7 +215,7 @@ propset_on_url(const char *propname,
 
   /* Open an RA session for the URL. Note that we don't have a local
      directory, nor a place to put temp files. */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, target,
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, target,
                                                NULL, NULL, FALSE, TRUE,
                                                ctx, pool));
 
@@ -472,7 +472,7 @@ svn_client_revprop_set2(const char *prop
 
   /* Open an RA session for the URL. Note that we don't have a local
      directory, nor a place to put temp files. */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, URL, NULL,
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, URL, NULL,
                                                NULL, FALSE, TRUE, ctx, pool));
 
   /* Resolve the revision into something real, and return that to the
@@ -964,7 +964,7 @@ svn_client_revprop_get(const char *propn
 
   /* Open an RA session for the URL. Note that we don't have a local
      directory, nor a place to put temp files. */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, URL, NULL,
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, URL, NULL,
                                                NULL, FALSE, TRUE, ctx, pool));
 
   /* Resolve the revision into something real, and return that to the
@@ -1308,7 +1308,7 @@ svn_client_revprop_list(apr_hash_t **pro
 
   /* Open an RA session for the URL. Note that we don't have a local
      directory, nor a place to put temp files. */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, URL, NULL,
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, URL, NULL,
                                                NULL, FALSE, TRUE, ctx, pool));
 
   /* Resolve the revision into something real, and return that to the

Modified: subversion/trunk/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/ra.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/ra.c (original)
+++ subversion/trunk/subversion/libsvn_client/ra.c Wed Aug 11 01:38:40 2010
@@ -280,8 +280,12 @@ get_client_string(void *baton,
   return SVN_NO_ERROR;
 }
 
+
+#define SVN_CLIENT__MAX_REDIRECT_ATTEMPTS 3 /* ### TODO:  Make configurable. */
+
 svn_error_t *
 svn_client__open_ra_session_internal(svn_ra_session_t **ra_session,
+                                     const char **corrected_url,
                                      const char *base_url,
                                      const char *base_dir_abspath,
                                      const apr_array_header_t *commit_items,
@@ -332,9 +336,63 @@ svn_client__open_ra_session_internal(svn
         SVN_ERR(err);
     }
 
-  return svn_error_return(svn_ra_open3(ra_session, base_url, uuid, cbtable, cb,
-                                       ctx->config, pool));
-}
+  /* If the caller allows for auto-following redirections, and the
+     RA->open() call above reveals a CORRECTED_URL, try the new URL.
+     We'll do this in a loop up to some maximum number follow-and-retry
+     attempts.  */
+  if (corrected_url)
+    {
+      apr_hash_t *attempted = apr_hash_make(pool);
+      int attempts_left = SVN_CLIENT__MAX_REDIRECT_ATTEMPTS;
+
+      *corrected_url = NULL;
+      while (attempts_left--)
+        {
+          const char *corrected = NULL;
+
+          /* Try to open the RA session.  If this is our last attempt,
+             don't accept corrected URLs from the RA provider. */
+          SVN_ERR(svn_ra_open4(ra_session,
+                               attempts_left == 0 ? NULL : &corrected,
+                               base_url, uuid, cbtable, cb, ctx->config, pool));
+
+          /* No error and no corrected URL?  We're done here. */
+          if (! corrected)
+            break;
+
+          /* Notify the user that a redirect is being followed. */
+          if (ctx->notify_func2 != NULL)
+            {
+              svn_wc_notify_t *notify = 
+                svn_wc_create_notify_url(corrected, 
+                                         svn_wc_notify_url_redirect, pool);
+              (*ctx->notify_func2)(ctx->notify_baton2, notify, pool);
+            }
+
+          /* Our caller will want to know what our final corrected URL was. */
+          *corrected_url = corrected;
+
+          /* Make sure we've not attempted this URL before. */
+          if (apr_hash_get(attempted, corrected, APR_HASH_KEY_STRING))
+            return svn_error_createf(SVN_ERR_CLIENT_CYCLE_DETECTED, NULL,
+                                     _("Redirect cycle detected for URL '%s'"),
+                                     corrected);
+
+          /* Remember this CORRECTED_URL so we don't wind up in a loop. */
+          apr_hash_set(attempted, corrected, APR_HASH_KEY_STRING, (void *)1);
+          base_url = corrected;
+        }
+    }
+  else
+    {
+      SVN_ERR(svn_ra_open4(ra_session, NULL, base_url,
+                           uuid, cbtable, cb, ctx->config, pool));
+    }
+
+  return SVN_NO_ERROR;
+ }
+#undef SVN_CLIENT__MAX_REDIRECT_ATTEMPTS
+
 
 svn_error_t *
 svn_client_open_ra_session(svn_ra_session_t **session,
@@ -342,9 +400,10 @@ svn_client_open_ra_session(svn_ra_sessio
                            svn_client_ctx_t *ctx,
                            apr_pool_t *pool)
 {
-  return svn_error_return(svn_client__open_ra_session_internal(session, url,
-                                              NULL, NULL,
-                                              FALSE, TRUE, ctx, pool));
+  return svn_error_return(
+             svn_client__open_ra_session_internal(session, NULL, url,
+                                                  NULL, NULL, FALSE, TRUE,
+                                                  ctx, pool));
 }
 
 
@@ -358,7 +417,7 @@ svn_client_uuid_from_url(const char **uu
   apr_pool_t *subpool = svn_pool_create(pool);
 
   /* use subpool to create a temporary RA session */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, url,
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, url,
                                                NULL, /* no base dir */
                                                NULL, FALSE, TRUE,
                                                ctx, subpool));
@@ -416,7 +475,7 @@ svn_client__ra_session_from_path(svn_ra_
   svn_opt_revision_t dead_end_rev;
   svn_opt_revision_t *ignored_rev, *new_rev;
   svn_revnum_t rev;
-  const char *ignored_url;
+  const char *ignored_url, *corrected_url;
 
   SVN_ERR(svn_client_url_from_path2(&initial_url, path_or_url, ctx, pool,
                                     pool));
@@ -431,11 +490,17 @@ svn_client__ra_session_from_path(svn_ra_
                                     TRUE,
                                     pool));
 
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, initial_url,
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, &corrected_url,
+                                               initial_url,
                                                base_dir_abspath, NULL,
                                                base_dir_abspath != NULL,
                                                FALSE, ctx, pool));
 
+  /* If we got a CORRECTED_URL, we'll want to refer to that as the
+     URL-ized form of PATH_OR_URL from now on. */
+  if (corrected_url && svn_path_is_url(path_or_url))
+    path_or_url = corrected_url;
+
   dead_end_rev.kind = svn_opt_revision_unspecified;
 
   /* Run the history function to get the object's (possibly
@@ -626,7 +691,7 @@ svn_client__repos_locations(const char *
 
   /* Open a RA session to this URL if we don't have one already. */
   if (! ra_session)
-    SVN_ERR(svn_client__open_ra_session_internal(&ra_session, url, NULL,
+    SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, url, NULL,
                                                  NULL, FALSE, TRUE,
                                                  ctx, subpool));
 

Modified: subversion/trunk/subversion/libsvn_client/relocate.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/relocate.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/relocate.c (original)
+++ subversion/trunk/subversion/libsvn_client/relocate.c Wed Aug 11 01:38:40 2010
@@ -66,6 +66,7 @@ validator_func(void *baton,
 {
   struct validator_baton_t *b = baton;
   struct url_uuid_t *url_uuid = NULL;
+  const char *disable_checks;
 
   apr_array_header_t *uuids = b->url_uuids;
   int i;
@@ -81,6 +82,16 @@ validator_func(void *baton,
         }
     }
 
+  disable_checks = getenv("SVN_I_LOVE_CORRUPTED_WORKING_COPIES_SO_DISABLE_RELOCATE_VALIDATION");
+  if (disable_checks && (strcmp(disable_checks, "yes") == 0))
+    {
+      /* Lie about URL_UUID's components, claiming they match the
+         expectations of the validation code below.  */
+      url_uuid = apr_pcalloc(pool, sizeof(*url_uuid));
+      url_uuid->root = apr_pstrdup(pool, root_url);
+      url_uuid->uuid = apr_pstrdup(pool, uuid);
+    }
+
   /* We use an RA session in a subpool to get the UUID of the
      repository at the new URL so we can force the RA session to close
      by destroying the subpool. */
@@ -88,7 +99,7 @@ validator_func(void *baton,
     {
       apr_pool_t *sesspool = svn_pool_create(pool);
       svn_ra_session_t *ra_session;
-      SVN_ERR(svn_client__open_ra_session_internal(&ra_session, url, NULL,
+      SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, url, NULL,
                                                    NULL, FALSE, TRUE,
                                                    b->ctx, sesspool));
       url_uuid = &APR_ARRAY_PUSH(uuids, struct url_uuid_t);

Modified: subversion/trunk/subversion/libsvn_client/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/status.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/status.c (original)
+++ subversion/trunk/subversion/libsvn_client/status.c Wed Aug 11 01:38:40 2010
@@ -192,7 +192,7 @@ reporter_finish_report(void *report_bato
 
   /* Open an RA session to our common ancestor and grab the locks under it.
    */
-  SVN_ERR(svn_client__open_ra_session_internal(&ras, rb->ancestor, NULL,
+  SVN_ERR(svn_client__open_ra_session_internal(&ras, NULL, rb->ancestor, NULL,
                                                NULL, FALSE, TRUE,
                                                rb->ctx, subpool));
 
@@ -394,7 +394,7 @@ svn_client_status5(svn_revnum_t *result_
                                     pool, pool));
 
       /* Open a repository session to the URL. */
-      SVN_ERR(svn_client__open_ra_session_internal(&ra_session, URL,
+      SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, URL,
                                                    dir_abspath,
                                                    NULL, FALSE, TRUE,
                                                    ctx, pool));

Modified: subversion/trunk/subversion/libsvn_client/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/update.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/update.c (original)
+++ subversion/trunk/subversion/libsvn_client/update.c Wed Aug 11 01:38:40 2010
@@ -78,8 +78,9 @@ file_fetcher(void *baton,
     SVN_ERR(svn_client__ensure_ra_session_url(&old_session_url, ffb->session,
                                               session_url, ffb->pool));
   else
-    SVN_ERR(svn_client__open_ra_session_internal(&(ffb->session), session_url,
-                                                 NULL, NULL, FALSE, TRUE,
+    SVN_ERR(svn_client__open_ra_session_internal(&(ffb->session), NULL,
+                                                 session_url, NULL, NULL,
+                                                 FALSE, TRUE,
                                                  ffb->ctx, ffb->pool));
 
   return svn_ra_get_file(ffb->session, base_name, revision, stream,
@@ -107,6 +108,7 @@ update_internal(svn_revnum_t *result_rev
   const svn_ra_reporter3_t *reporter;
   void *report_baton;
   const char *anchor_url;
+  const char *corrected_url;
   const char *target;
   const char *repos_root;
   svn_error_t *err;
@@ -188,9 +190,19 @@ update_internal(svn_revnum_t *result_rev
     : NULL;
 
   /* Open an RA session for the URL */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, anchor_url,
-                                               anchor_abspath, NULL, TRUE, TRUE,
-                                               ctx, pool));
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, &corrected_url,
+                                               anchor_url,
+                                               anchor_abspath, NULL, TRUE,
+                                               TRUE, ctx, pool));
+
+  /* If we got a corrected URL from the RA subsystem, we'll need to
+     relocate our working copy first. */
+  if (corrected_url)
+    {
+      SVN_ERR(svn_client_relocate(anchor_abspath, anchor_url, corrected_url,
+                                  TRUE, ctx, pool));
+      anchor_url = corrected_url;
+    }
 
   /* ### todo: shouldn't svn_client__get_revision_number be able
      to take a URL as easily as a local path?  */

Modified: subversion/trunk/subversion/libsvn_client/url.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/url.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/url.c (original)
+++ subversion/trunk/subversion/libsvn_client/url.c Wed Aug 11 01:38:40 2010
@@ -116,9 +116,10 @@ svn_client__derive_location(const char *
     {
       if (ra_session == NULL)
         {
-          SVN_ERR(svn_client__open_ra_session_internal(&ra_session, *url, NULL,
-                                                       NULL, FALSE, TRUE, ctx,
-                                                       scratch_pool));
+          SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL,
+                                                       *url, NULL, NULL,
+                                                       FALSE, TRUE,
+                                                       ctx, scratch_pool));
         }
       SVN_ERR(svn_client__get_revision_number(peg_revnum, NULL, ctx->wc_ctx,
                                               NULL, ra_session, peg_revision,

Modified: subversion/trunk/subversion/libsvn_ra/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/deprecated.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_ra/deprecated.c Wed Aug 11 01:38:40 2010
@@ -30,6 +30,7 @@
 #include "svn_path.h"
 #include "svn_compat.h"
 #include "svn_props.h"
+#include "svn_pools.h"
 
 #include "ra_loader.h"
 
@@ -148,6 +149,18 @@ static svn_ra_reporter2_t reporter_3in2_
   abort_report
 };
 
+svn_error_t *svn_ra_open3(svn_ra_session_t **session_p,
+                          const char *repos_URL,
+                          const char *uuid,
+                          const svn_ra_callbacks2_t *callbacks,
+                          void *callback_baton,
+                          apr_hash_t *config,
+                          apr_pool_t *pool)
+{
+  return svn_ra_open4(session_p, NULL, repos_URL, uuid,
+                      callbacks, callback_baton, config, pool);
+}
+
 svn_error_t *svn_ra_open2(svn_ra_session_t **session_p,
                           const char *repos_URL,
                           const svn_ra_callbacks2_t *callbacks,

Modified: subversion/trunk/subversion/libsvn_ra/ra_loader.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/ra_loader.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/trunk/subversion/libsvn_ra/ra_loader.c Wed Aug 11 01:38:40 2010
@@ -268,7 +268,8 @@ svn_ra_create_callbacks(svn_ra_callbacks
   return SVN_NO_ERROR;
 }
 
-svn_error_t *svn_ra_open3(svn_ra_session_t **session_p,
+svn_error_t *svn_ra_open4(svn_ra_session_t **session_p,
+                          const char **corrected_url_p,
                           const char *repos_URL,
                           const char *uuid,
                           const svn_ra_callbacks2_t *callbacks,
@@ -276,6 +277,7 @@ svn_error_t *svn_ra_open3(svn_ra_session
                           apr_hash_t *config,
                           apr_pool_t *pool)
 {
+  apr_pool_t *sesspool = svn_pool_create(pool);
   svn_ra_session_t *session;
   const struct ra_lib_defn *defn;
   const svn_ra__vtable_t *vtable = NULL;
@@ -294,6 +296,10 @@ svn_error_t *svn_ra_open3(svn_ra_session
   svn_boolean_t store_pp = SVN_CONFIG_DEFAULT_OPTION_STORE_SSL_CLIENT_CERT_PP;
   const char *store_pp_plaintext
     = SVN_CONFIG_DEFAULT_OPTION_STORE_SSL_CLIENT_CERT_PP_PLAINTEXT;
+  const char *corrected_url;
+
+  /* Initialize the return variable. */
+  *session_p = NULL;
 
   if (callbacks->auth_baton)
     {
@@ -357,7 +363,7 @@ svn_error_t *svn_ra_open3(svn_ra_session
 
           /* Find out where we're about to connect to, and
            * try to pick a server group based on the destination. */
-          apr_err = apr_uri_parse(pool, repos_URL, &repos_URI);
+          apr_err = apr_uri_parse(sesspool, repos_URL, &repos_URI);
           /* ### Should apr_uri_parse leave hostname NULL?  It doesn't
            * for "file:///" URLs, only for bogus URLs like "bogus".
            * If this is the right behavior for apr_uri_parse, maybe we
@@ -367,7 +373,8 @@ svn_error_t *svn_ra_open3(svn_ra_session
                                      _("Illegal repository URL '%s'"),
                                      repos_URL);
           server_group = svn_config_find_group(servers, repos_URI.hostname,
-                                               SVN_CONFIG_SECTION_GROUPS, pool);
+                                               SVN_CONFIG_SECTION_GROUPS,
+                                               sesspool);
 
           if (server_group)
             {
@@ -458,12 +465,12 @@ svn_error_t *svn_ra_open3(svn_ra_session
 
           if (! initfunc)
             SVN_ERR(load_ra_module(&initfunc, NULL, defn->ra_name,
-                                   pool));
+                                   sesspool));
           if (! initfunc)
             /* Library not found. */
             continue;
 
-          SVN_ERR(initfunc(svn_ra_version(), &vtable, pool));
+          SVN_ERR(initfunc(svn_ra_version(), &vtable, sesspool));
 
           SVN_ERR(check_ra_version(vtable->get_version(), scheme));
 
@@ -477,25 +484,36 @@ svn_error_t *svn_ra_open3(svn_ra_session
                              repos_URL);
 
   /* Create the session object. */
-  session = apr_pcalloc(pool, sizeof(*session));
+  session = apr_pcalloc(sesspool, sizeof(*session));
   session->vtable = vtable;
-  session->pool = pool;
+  session->pool = sesspool;
 
   /* Ask the library to open the session. */
-  SVN_ERR_W(vtable->open_session(session, repos_URL, callbacks, callback_baton,
-                               config, pool),
+  SVN_ERR_W(vtable->open_session(session, &corrected_url, repos_URL,
+                                 callbacks, callback_baton, config, sesspool),
             apr_psprintf(pool, "Unable to connect to a repository at URL '%s'",
                          repos_URL));
-
+  
+  /* If the session open stuff detected a server-provided URL
+     correction (a 301 or 302 redirect response during the initial
+     OPTIONS request), then kill the session so the caller can decide
+     what to do. */
+  if (corrected_url_p && corrected_url)
+    {
+      *corrected_url_p = apr_pstrdup(pool, corrected_url);
+      svn_pool_destroy(sesspool);
+      return SVN_NO_ERROR;
+    }
+  
   /* Check the UUID. */
   if (uuid)
     {
       const char *repository_uuid;
 
       SVN_ERR(vtable->get_uuid(session, &repository_uuid, pool));
-
       if (strcmp(uuid, repository_uuid) != 0)
         {
+          svn_pool_destroy(sesspool);
           return svn_error_createf(SVN_ERR_RA_UUID_MISMATCH, NULL,
                                    _("Repository UUID '%s' doesn't match "
                                      "expected UUID '%s'"),

Modified: subversion/trunk/subversion/libsvn_ra/ra_loader.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/ra_loader.h?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/ra_loader.h (original)
+++ subversion/trunk/subversion/libsvn_ra/ra_loader.h Wed Aug 11 01:38:40 2010
@@ -54,6 +54,7 @@ typedef struct svn_ra__vtable_t {
   /* All fields in SESSION, except priv, have been initialized by the
      time this is called.  SESSION->priv may be set by this function. */
   svn_error_t *(*open_session)(svn_ra_session_t *session,
+                               const char **corrected_url,
                                const char *repos_URL,
                                const svn_ra_callbacks2_t *callbacks,
                                void *callback_baton,

Modified: subversion/trunk/subversion/libsvn_ra/wrapper_template.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/wrapper_template.h?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/wrapper_template.h (original)
+++ subversion/trunk/subversion/libsvn_ra/wrapper_template.h Wed Aug 11 01:38:40 2010
@@ -71,12 +71,15 @@ static svn_error_t *compat_open(void **s
    * the alternative (creating a new ra_util library) would be massive
    * overkill for the time being.  Just be sure to keep the following
    * line and the code of svn_ra_create_callbacks in sync.  */
-  svn_ra_callbacks2_t *callbacks2 = apr_pcalloc(pool,
+  apr_pool_t *sesspool = svn_pool_create(pool);
+  svn_ra_callbacks2_t *callbacks2 = apr_pcalloc(sesspool,
                                                 sizeof(*callbacks2));
 
-  svn_ra_session_t *sess = apr_pcalloc(pool, sizeof(*sess));
+  svn_ra_session_t *sess = apr_pcalloc(sesspool, sizeof(*sess));
+  const char *session_url;
+
   sess->vtable = &VTBL;
-  sess->pool = pool;
+  sess->pool = sesspool;
 
   callbacks2->open_tmp_file = callbacks->open_tmp_file;
   callbacks2->auth_baton = callbacks->auth_baton;
@@ -87,8 +90,18 @@ static svn_error_t *compat_open(void **s
   callbacks2->progress_func = NULL;
   callbacks2->progress_baton = NULL;
 
-  SVN_ERR(VTBL.open_session(sess, repos_URL, callbacks2, callback_baton,
-                            config, pool));
+  SVN_ERR(VTBL.open_session(sess, &session_url, repos_URL,
+                            callbacks2, callback_baton, config, sesspool));
+
+  if (strcmp(repos_URL, session_url) != 0)
+    {
+      svn_pool_destroy(sesspool);
+      return svn_error_createf(SVN_ERR_RA_SESSION_URL_MISMATCH, NULL,
+                               _("Session URL '%s' does not match requested "
+                                 " URL '%s', and redirection was disallowed."),
+                               session_url, repos_URL);
+    }
+
   *session_baton = sess;
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c Wed Aug 11 01:38:40 2010
@@ -437,6 +437,7 @@ ignore_warnings(void *baton,
 
 static svn_error_t *
 svn_ra_local__open(svn_ra_session_t *session,
+                   const char **corrected_url,
                    const char *repos_URL,
                    const svn_ra_callbacks2_t *callbacks,
                    void *callback_baton,
@@ -446,6 +447,10 @@ svn_ra_local__open(svn_ra_session_t *ses
   svn_ra_local__session_baton_t *sess;
   const char *fs_path;
 
+  /* We don't support redirections in ra-local. */
+  if (corrected_url)
+    *corrected_url = NULL;
+
   /* Allocate and stash the session_sess args we have already. */
   sess = apr_pcalloc(pool, sizeof(*sess));
   sess->callbacks = callbacks;

Modified: subversion/trunk/subversion/libsvn_ra_neon/fetch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/fetch.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/fetch.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/fetch.c Wed Aug 11 01:38:40 2010
@@ -1097,7 +1097,8 @@ svn_error_t *svn_ra_neon__get_latest_rev
      PROPFINDs. */
   if (SVN_RA_NEON__HAVE_HTTPV2_SUPPORT(ras))
     {
-      SVN_ERR(svn_ra_neon__exchange_capabilities(ras, latest_revnum, pool));
+      SVN_ERR(svn_ra_neon__exchange_capabilities(ras, NULL, 
+                                                 latest_revnum, pool));
       if (! SVN_IS_VALID_REVNUM(*latest_revnum))
         return svn_error_create(SVN_ERR_RA_DAV_OPTIONS_REQ_FAILED, NULL,
                                 _("The OPTIONS response did not include "

Modified: subversion/trunk/subversion/libsvn_ra_neon/options.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/options.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/options.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/options.c Wed Aug 11 01:38:40 2010
@@ -249,6 +249,7 @@ parse_capabilities(ne_request *req,
 
 svn_error_t *
 svn_ra_neon__exchange_capabilities(svn_ra_neon__session_t *ras,
+                                   const char **relocation_location,
                                    svn_revnum_t *youngest_rev,
                                    apr_pool_t *pool)
 {
@@ -262,6 +263,8 @@ svn_ra_neon__exchange_capabilities(svn_r
   oc.cdata = svn_stringbuf_create("", pool);
 
   *youngest_rev = SVN_INVALID_REVNUM;
+  if (relocation_location)
+    *relocation_location = NULL;
 
   SVN_ERR(svn_ra_neon__request_create(&req, ras, "OPTIONS", ras->url->data,
                                       pool));
@@ -281,9 +284,17 @@ svn_ra_neon__exchange_capabilities(svn_r
                                            "<D:options xmlns:D=\"DAV:\">"
                                            "<D:activity-collection-set/>"
                                            "</D:options>",
-                                           200, 0, pool)))
+                                           200,
+                                           relocation_location ? 301 : 0,
+                                           pool)))
     goto cleanup;
 
+  if (req->code == 301)
+    {
+      *relocation_location = svn_ra_neon__request_get_location(req, pool);
+      goto cleanup;
+    }
+
   /* Was there an XML parse error somewhere? */
   err = svn_ra_neon__check_parse_error("OPTIONS", parser, ras->url->data);
   if (err)
@@ -317,7 +328,8 @@ svn_ra_neon__get_activity_collection(con
 {
   svn_revnum_t ignored_revnum;
   if (! ras->act_coll)
-    SVN_ERR(svn_ra_neon__exchange_capabilities(ras, &ignored_revnum, pool));
+    SVN_ERR(svn_ra_neon__exchange_capabilities(ras, NULL, 
+                                               &ignored_revnum, pool));
   *activity_coll = svn_string_create(ras->act_coll, pool);
   return SVN_NO_ERROR;
 }
@@ -347,7 +359,8 @@ svn_ra_neon__has_capability(svn_ra_sessi
   if (cap_result == NULL)
     {
       svn_revnum_t ignored_revnum;
-      SVN_ERR(svn_ra_neon__exchange_capabilities(ras, &ignored_revnum, pool));
+      SVN_ERR(svn_ra_neon__exchange_capabilities(ras, NULL,
+                                                 &ignored_revnum, pool));
     }
 
 

Modified: subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h Wed Aug 11 01:38:40 2010
@@ -944,12 +944,10 @@ svn_ra_neon__maybe_store_auth_info_after
    NULL, as this will cause Neon to generate a "Content-Length: 0"
    header (which is important to some proxies).
 
-   OKAY_1 and OKAY_2 are the "acceptable" result codes. Anything other
-   than one of these will generate an error. OKAY_1 should always be
-   specified (e.g. as 200); use 0 for OKAY_2 if a second result code is
-   not allowed.
-
- */
+   OKAY_1 and OKAY_2 are the "acceptable" result codes.  Anything
+   other than one of these will generate an error.  OKAY_1 should
+   always be specified (e.g. as 200); use 0 for OKAY_2 if additional
+   result codes aren't allowed.  */
 svn_error_t *
 svn_ra_neon__request_dispatch(int *code_p,
                               svn_ra_neon__request_t *request,
@@ -972,8 +970,9 @@ svn_ra_neon__simple_request(int *code,
                             const char *url,
                             apr_hash_t *extra_headers,
                             const char *body,
-                            int okay_1, int okay_2, apr_pool_t *pool);
-
+                            int okay_1,
+                            int okay_2,
+                            apr_pool_t *pool);
 
 /* Convenience statement macro for setting headers in a hash */
 #define svn_ra_neon__set_header(hash, hdr, val) \
@@ -1108,14 +1107,22 @@ svn_ra_neon__has_capability(svn_ra_sessi
    RAS->capabilities with the server's capabilities as read from the
    response headers.  Use POOL only for temporary allocation.
 
+   If the RELOCATION_LOCATION is non-NULL, allow the OPTIONS response
+   to report a server-dictated redirect or relocation (HTTP 301 or 302
+   error codes), setting *RELOCATION_LOCATION to the value of the
+   corrected repository URL.  Otherwise, such responses from the
+   server will generate an error.  (In either case, no capabilities are
+   exchanged if there is, in fact, such a response from the server.)
+
    If the server is kind enough to tell us the current youngest
    revision of the target repository, set *YOUNGEST_REV to that value;
    set it to SVN_INVALID_REVNUM otherwise.
 
-  NOTE:  This function also expects the server to announce the
+   NOTE:  This function also expects the server to announce the
    activity collection.  */
 svn_error_t *
 svn_ra_neon__exchange_capabilities(svn_ra_neon__session_t *ras,
+                                   const char **relocation_location,
                                    svn_revnum_t *youngest_rev,
                                    apr_pool_t *pool);
 

Modified: subversion/trunk/subversion/libsvn_ra_neon/session.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/session.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/session.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/session.c Wed Aug 11 01:38:40 2010
@@ -772,6 +772,7 @@ ensure_neon_initialized(void)
 
 static svn_error_t *
 svn_ra_neon__open(svn_ra_session_t *session,
+                  const char **corrected_url,
                   const char *repos_URL,
                   const svn_ra_callbacks2_t *callbacks,
                   void *callback_baton,
@@ -1073,7 +1074,8 @@ svn_ra_neon__open(svn_ra_session_t *sess
 
   session->priv = ras;
 
-  return svn_ra_neon__exchange_capabilities(ras, &ignored_revnum, pool);
+  return svn_ra_neon__exchange_capabilities(ras, corrected_url,
+                                            &ignored_revnum, pool);
 }
 
 

Modified: subversion/trunk/subversion/libsvn_ra_neon/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/util.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/util.c Wed Aug 11 01:38:40 2010
@@ -562,6 +562,7 @@ generate_error(svn_ra_neon__request_t *r
 
         case 301:
         case 302:
+        case 307:
           return svn_error_create
             (SVN_ERR_RA_DAV_RELOCATED, NULL,
              apr_psprintf(pool,
@@ -1263,12 +1264,10 @@ parsed_request(svn_ra_neon__request_t *r
                                                  success_parser, pool));
 
   /* run the request and get the resulting status code. */
-  SVN_ERR(svn_ra_neon__request_dispatch(status_code,
-                                        req, extra_headers, body,
-                                        (strcmp(method, "PROPFIND") == 0)
-                                        ? 207 : 200,
-                                        0, /* not used */
-                                        pool));
+  SVN_ERR(svn_ra_neon__request_dispatch(
+              status_code, req, extra_headers, body,
+              (strcmp(method, "PROPFIND") == 0) ? 207 : 200,
+              0, pool));
 
   if (spool_response)
     {

Modified: subversion/trunk/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/options.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/options.c Wed Aug 11 01:38:40 2010
@@ -474,12 +474,9 @@ svn_ra_serf__create_options_req(svn_ra_s
 
 /** Capabilities exchange. */
 
-/* Exchange capabilities with the server, by sending an OPTIONS
-   request announcing the client's capabilities, and by filling
-   SERF_SESS->capabilities with the server's capabilities as read
-   from the response headers.  Use POOL only for temporary allocation. */
 svn_error_t *
 svn_ra_serf__exchange_capabilities(svn_ra_serf__session_t *serf_sess,
+                                   const char **corrected_url,
                                    apr_pool_t *pool)
 {
   svn_ra_serf__options_context_t *opt_ctx;
@@ -492,6 +489,17 @@ svn_ra_serf__exchange_capabilities(svn_r
   err = svn_ra_serf__context_run_wait(
             svn_ra_serf__get_options_done_ptr(opt_ctx), serf_sess, pool);
 
+  /* If our caller cares about server redirections, and our response
+     carries such a thing, report as much.  We'll disregard ERR --
+     it's most likely just a complaint about the response body not
+     successfully parsing as XML or somesuch. */
+  if (corrected_url && (opt_ctx->status_code == 301))
+    {
+      svn_error_clear(err);
+      *corrected_url = opt_ctx->parser_ctx->location;
+      return SVN_NO_ERROR;
+    }
+                        
   return svn_error_compose_create(
              svn_ra_serf__error_on_status(opt_ctx->status_code,
                                           serf_sess->repos_url.path,
@@ -522,7 +530,7 @@ svn_ra_serf__has_capability(svn_ra_sessi
 
   /* If any capability is unknown, they're all unknown, so ask. */
   if (cap_result == NULL)
-    SVN_ERR(svn_ra_serf__exchange_capabilities(serf_sess, pool));
+    SVN_ERR(svn_ra_serf__exchange_capabilities(serf_sess, NULL, pool));
 
   /* Try again, now that we've fetched the capabilities. */
   cap_result = apr_hash_get(serf_sess->capabilities,

Modified: subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Wed Aug 11 01:38:40 2010
@@ -1375,11 +1375,20 @@ svn_error_t * svn_ra_serf__get_mergeinfo
                                          apr_pool_t *pool);
 
 /* Exchange capabilities with the server, by sending an OPTIONS
-   request announcing the client's capabilities, and by filling
-   SERF_SESS->capabilities with the server's capabilities as read
-   from the response headers.  Use POOL only for temporary allocation. */
+ * request announcing the client's capabilities, and by filling
+ * SERF_SESS->capabilities with the server's capabilities as read from
+ * the response headers.  Use POOL only for temporary allocation.
+ *
+ * If the CORRECTED_URL is non-NULL, allow the OPTIONS response to
+ * report a server-dictated redirect or relocation (HTTP 301 or 302
+ * error codes), setting *CORRECTED_URL to the value of the corrected
+ * repository URL.  Otherwise, such responses from the server will
+ * generate an error.  (In either case, no capabilities are exchanged
+ * if there is, in fact, such a response from the server.)
+ */
 svn_error_t *
 svn_ra_serf__exchange_capabilities(svn_ra_serf__session_t *serf_sess,
+                                   const char **corrected_url,
                                    apr_pool_t *pool);
 
 /* Implements the has_capability RA layer function. */

Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Wed Aug 11 01:38:40 2010
@@ -331,6 +331,7 @@ svn_ra_serf__progress(void *progress_bat
 
 static svn_error_t *
 svn_ra_serf__open(svn_ra_session_t *session,
+                  const char **corrected_url,
                   const char *repos_URL,
                   const svn_ra_callbacks2_t *callbacks,
                   void *callback_baton,
@@ -342,6 +343,9 @@ svn_ra_serf__open(svn_ra_session_t *sess
   apr_uri_t url;
   const char *client_string = NULL;
 
+  if (corrected_url)
+    *corrected_url = NULL;
+
   serf_sess = apr_pcalloc(pool, sizeof(*serf_sess));
   serf_sess->pool = svn_pool_create(pool);
   serf_sess->bkt_alloc = serf_bucket_allocator_create(serf_sess->pool, NULL,
@@ -452,7 +456,7 @@ svn_ra_serf__open(svn_ra_session_t *sess
 
   session->priv = serf_sess;
 
-  return svn_ra_serf__exchange_capabilities(serf_sess, pool);
+  return svn_ra_serf__exchange_capabilities(serf_sess, corrected_url, pool);
 }
 
 static svn_error_t *

Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Wed Aug 11 01:38:40 2010
@@ -1169,7 +1169,7 @@ svn_ra_serf__handle_xml_parser(serf_requ
       *ctx->status_code = sl.code;
     }
 
-  if (sl.code == 301 || sl.code == 302)
+  if (sl.code == 301 || sl.code == 302 || sl.code == 307)
     {
       ctx->location = svn_ra_serf__response_get_location(response, pool);
     }
@@ -1860,6 +1860,7 @@ svn_ra_serf__error_on_status(int status_
     {
       case 301:
       case 302:
+      case 307:
         return svn_error_createf(SVN_ERR_RA_DAV_RELOCATED, NULL,
                                  (status_code == 301)
                                  ? _("Repository moved permanently to '%s';"

Modified: subversion/trunk/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/client.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/client.c Wed Aug 11 01:38:40 2010
@@ -685,7 +685,9 @@ ra_svn_get_schemes(apr_pool_t *pool)
 
 
 
-static svn_error_t *ra_svn_open(svn_ra_session_t *session, const char *url,
+static svn_error_t *ra_svn_open(svn_ra_session_t *session,
+                                const char **corrected_url,
+                                const char *url,
                                 const svn_ra_callbacks2_t *callbacks,
                                 void *callback_baton,
                                 apr_hash_t *config,
@@ -697,6 +699,10 @@ static svn_error_t *ra_svn_open(svn_ra_s
   apr_uri_t uri;
   svn_config_t *cfg, *cfg_client;
 
+  /* We don't support server-prescribed redirections in ra-svn. */
+  if (corrected_url)
+    *corrected_url = NULL;
+
   SVN_ERR(parse_url(url, &uri, sess_pool));
 
   parse_tunnel(url, &tunnel, pool);

Modified: subversion/trunk/subversion/svn/notify.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/notify.c?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/notify.c (original)
+++ subversion/trunk/subversion/svn/notify.c Wed Aug 11 01:38:40 2010
@@ -881,6 +881,12 @@ notify(void *baton, const svn_wc_notify_
           goto print_error;
       break;
 
+    case svn_wc_notify_url_redirect:
+      err = svn_cmdline_printf(pool, _("Redirecting to URL '%s'\n"),
+                               n->url);
+      if (err)
+        goto print_error;
+
     default:
       break;
     }

Modified: subversion/trunk/subversion/tests/cmdline/README
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/README?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/README (original)
+++ subversion/trunk/subversion/tests/cmdline/README Wed Aug 11 01:38:40 2010
@@ -72,7 +72,7 @@ paths adjusted appropriately:
      AuthUserFile /usr/local/apache2/conf/users
      Require valid-user
    </Location>
-     
+
    <Location /svn-test-work/local_tmp/repos>
      DAV svn
      SVNPath /home/yourusernamehere/projects/svn/subversion/tests/cmdline/svn-test-work/local_tmp/repos
@@ -83,6 +83,9 @@ paths adjusted appropriately:
      Require valid-user
    </Location>
 
+   RedirectMatch permanent ^/svn-test-work/repositories/REDIRECT-PERM-(.*)$ /svn-test-work/repositories/$1
+   RedirectMatch           ^/svn-test-work/repositories/REDIRECT-TEMP-(.*)$ /svn-test-work/repositories/$1
+
 Httpd should be running on port 80.  You may also need to ensure that
 it's running as you, so it has read/write access to the repositories
 that are probably living in your Subversion working copy.  To do this,

Modified: subversion/trunk/subversion/tests/cmdline/davautocheck.sh
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/davautocheck.sh?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/davautocheck.sh (original)
+++ subversion/trunk/subversion/tests/cmdline/davautocheck.sh Wed Aug 11 01:38:40 2010
@@ -321,6 +321,8 @@ CustomLog           "$HTTPD_ROOT/ops" "%
   AuthUserFile      $HTTPD_USERS
   Require           valid-user
 </Location>
+RedirectMatch permanent ^/svn-test-work/repositories/REDIRECT-PERM-(.*)\$ /svn-test-work/repositories/\$1
+RedirectMatch           ^/svn-test-work/repositories/REDIRECT-TEMP-(.*)\$ /svn-test-work/repositories/\$1
 __EOF__
 
 START="$HTTPD -f $HTTPD_CFG"

Modified: subversion/trunk/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/actions.py?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/actions.py Wed Aug 11 01:38:40 2010
@@ -38,6 +38,12 @@ def no_sleep_for_timestamps():
 def do_sleep_for_timestamps():
   os.environ['SVN_I_LOVE_CORRUPTED_WORKING_COPIES_SO_DISABLE_SLEEP_FOR_TIMESTAMPS'] = 'no'
 
+def no_relocate_validation():
+  os.environ['SVN_I_LOVE_CORRUPTED_WORKING_COPIES_SO_DISABLE_RELOCATE_VALIDATION'] = 'yes'
+
+def do_relocate_validation():
+  os.environ['SVN_I_LOVE_CORRUPTED_WORKING_COPIES_SO_DISABLE_RELOCATE_VALIDATION'] = 'no'
+
 def setup_pristine_greek_repository():
   """Create the pristine repository and 'svn import' the greek tree"""
 

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Wed Aug 11 01:38:40 2010
@@ -1192,6 +1192,7 @@ class TestRunner:
                                       str(self.index)
 
     svntest.actions.no_sleep_for_timestamps()
+    svntest.actions.do_relocate_validation()
 
     saved_dir = os.getcwd()
     try:

Modified: subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py?rev=984280&r1=984279&r2=984280&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py Wed Aug 11 01:38:40 2010
@@ -164,6 +164,19 @@ class Sandbox:
       wc_dir = self.wc_dir
     return os.path.join(wc_dir, svntest.wc.to_ospath(relpath))
 
+  def redirected_root_url(self, temporary=False):
+    """If TEMPORARY is set, return the URL which should be configured
+       to temporarily redirect to the root of this repository;
+       otherwise, return the URL which should be configured to
+       permanent redirect there.  (Assumes that the sandbox is not
+       read-only.)"""
+    assert not self.read_only
+    assert self.repo_url.startswith("http")
+    parts = self.repo_url.rsplit('/', 1)
+    return '%s/REDIRECT-%s-%s' % (parts[0],
+                                  temporary and 'TEMP' or 'PERM',
+                                  parts[1])
+    
   def simple_commit(self, target=None):
     assert not self.read_only
     if target is None:



RE: NOTICE: Testing over ra-dav has changed in trunk!!

Posted by Julian Foad <ju...@wandisco.com>.
Bert Huijben wrote:
> From: Julian Foad [mailto:julian.foad@wandisco.com]
> > > > NOTE:  The test suite changes brought in by this merge require
> > > > modifications to developers' httpd.conf files.  So if you see the
> > > > redirect_tests.py all failing, make sure you've updated your Apache
> > > > configuration per the instructions in the
> > > > subversion/tests/cmdline/README file.
> > 
> > In r984365 I've updated davautocheck.sh to load mod_alias which is
> > required for these RedirectMatch directives.
> 
> And r984348 applied the redirects and module load in win-tests.py to
> fix the tests on Windows.

Bert wrote on IRC:
  julianf: The test runs ok, but it looks like neon does something wrong
on the redirect
  cmpilato: The win32-ra buildbot confirms that the redirect tests pass
on ra_serf, but the centos bot shows an error using ra_neon

The centos bot's log of this failure is at
<http://ci.apache.org/builders/svn-x64-centos%
20gcc/builds/904/steps/Test%20fsfs%2Bra_neon/logs/faillog> and contains:

[[[
CMD: svn co
http://localhost:21834/svn-test-work/repositories/REDIRECT-PERM-redirect_tests-1 svn-test-work/working_copies/redirect_tests-1.my --config-dir /home/bt/slaves/x64-centos/build/subversion/tests/cmdline/svn-test-work/local_tmp/config --password rayjandom --no-auth-cache --username jrandom
CMD: /home/bt/slaves/x64-centos/build/subversion/svn/svn co http://localhost:21834/svn-test-work/repositories/REDIRECT-PERM-redirect_tests-1 svn-test-work/working_copies/redirect_tests-1.my --config-dir /home/bt/slaves/x64-centos/build/subversion/tests/cmdline/svn-test-work/local_tmp/config --password rayjandom --no-auth-cache --username jrandom exited with 1
<TIME = 0.098542>
Redirecting to URL '/svn-test-work/repositories/redirect_tests-1'
subversion/svn/checkout-cmd.c:172: (apr_err=170000)
subversion/libsvn_client/checkout.c:152: (apr_err=170000)
subversion/libsvn_client/ra.c:497: (apr_err=170000)
subversion/libsvn_client/ra.c:357: (apr_err=170000)
subversion/libsvn_ra/ra_loader.c:372: (apr_err=170000)
svn: Illegal repository URL '/svn-test-work/repositories/redirect_tests-1'
]]]

- Julian



RE: NOTICE: Testing over ra-dav has changed in trunk!!

Posted by Julian Foad <ju...@wandisco.com>.
Bert Huijben wrote:
> From: Julian Foad [mailto:julian.foad@wandisco.com]
> > > > NOTE:  The test suite changes brought in by this merge require
> > > > modifications to developers' httpd.conf files.  So if you see the
> > > > redirect_tests.py all failing, make sure you've updated your Apache
> > > > configuration per the instructions in the
> > > > subversion/tests/cmdline/README file.
> > 
> > In r984365 I've updated davautocheck.sh to load mod_alias which is
> > required for these RedirectMatch directives.
> 
> And r984348 applied the redirects and module load in win-tests.py to
> fix the tests on Windows.

Bert wrote on IRC:
  julianf: The test runs ok, but it looks like neon does something wrong
on the redirect
  cmpilato: The win32-ra buildbot confirms that the redirect tests pass
on ra_serf, but the centos bot shows an error using ra_neon

The centos bot's log of this failure is at
<http://ci.apache.org/builders/svn-x64-centos%
20gcc/builds/904/steps/Test%20fsfs%2Bra_neon/logs/faillog> and contains:

[[[
CMD: svn co
http://localhost:21834/svn-test-work/repositories/REDIRECT-PERM-redirect_tests-1 svn-test-work/working_copies/redirect_tests-1.my --config-dir /home/bt/slaves/x64-centos/build/subversion/tests/cmdline/svn-test-work/local_tmp/config --password rayjandom --no-auth-cache --username jrandom
CMD: /home/bt/slaves/x64-centos/build/subversion/svn/svn co http://localhost:21834/svn-test-work/repositories/REDIRECT-PERM-redirect_tests-1 svn-test-work/working_copies/redirect_tests-1.my --config-dir /home/bt/slaves/x64-centos/build/subversion/tests/cmdline/svn-test-work/local_tmp/config --password rayjandom --no-auth-cache --username jrandom exited with 1
<TIME = 0.098542>
Redirecting to URL '/svn-test-work/repositories/redirect_tests-1'
subversion/svn/checkout-cmd.c:172: (apr_err=170000)
subversion/libsvn_client/checkout.c:152: (apr_err=170000)
subversion/libsvn_client/ra.c:497: (apr_err=170000)
subversion/libsvn_client/ra.c:357: (apr_err=170000)
subversion/libsvn_ra/ra_loader.c:372: (apr_err=170000)
svn: Illegal repository URL '/svn-test-work/repositories/redirect_tests-1'
]]]

- Julian


RE: NOTICE: Testing over ra-dav has changed in trunk!!

Posted by Bert Huijben <be...@vmoo.com>.

> -----Original Message-----
> From: Julian Foad [mailto:julian.foad@wandisco.com]
> Sent: woensdag 11 augustus 2010 12:41
> To: C. Michael Pilato
> Cc: dev@subversion.apache.org; cmpilato@apache.org;
> commits@subversion.apache.org
> Subject: Re: NOTICE: Testing over ra-dav has changed in trunk!!
> 
> On Tue, 2010-08-10, C. Michael Pilato wrote:
> > Per the commit's log message:
> >
> > On 08/10/2010 09:38 PM, cmpilato@apache.org wrote:
> > > Author: cmpilato
> > > Date: Wed Aug 11 01:38:40 2010
> > > New Revision: 984280
> >
> > [...]
> >
> > > NOTE:  The test suite changes brought in by this merge require
> > > modifications to developers' httpd.conf files.  So if you see the
> > > redirect_tests.py all failing, make sure you've updated your Apache
> > > configuration per the instructions in the
> > > subversion/tests/cmdline/README file.
> 
> In r984365 I've updated davautocheck.sh to load mod_alias which is
> required for these RedirectMatch directives.

And r984348 applied the redirects and module load in win-tests.py to fix the tests on Windows.

	Bert 



RE: NOTICE: Testing over ra-dav has changed in trunk!!

Posted by Bert Huijben <be...@vmoo.com>.

> -----Original Message-----
> From: Julian Foad [mailto:julian.foad@wandisco.com]
> Sent: woensdag 11 augustus 2010 12:41
> To: C. Michael Pilato
> Cc: dev@subversion.apache.org; cmpilato@apache.org;
> commits@subversion.apache.org
> Subject: Re: NOTICE: Testing over ra-dav has changed in trunk!!
> 
> On Tue, 2010-08-10, C. Michael Pilato wrote:
> > Per the commit's log message:
> >
> > On 08/10/2010 09:38 PM, cmpilato@apache.org wrote:
> > > Author: cmpilato
> > > Date: Wed Aug 11 01:38:40 2010
> > > New Revision: 984280
> >
> > [...]
> >
> > > NOTE:  The test suite changes brought in by this merge require
> > > modifications to developers' httpd.conf files.  So if you see the
> > > redirect_tests.py all failing, make sure you've updated your Apache
> > > configuration per the instructions in the
> > > subversion/tests/cmdline/README file.
> 
> In r984365 I've updated davautocheck.sh to load mod_alias which is
> required for these RedirectMatch directives.

And r984348 applied the redirects and module load in win-tests.py to fix the tests on Windows.

	Bert 


Re: NOTICE: Testing over ra-dav has changed in trunk!!

Posted by Julian Foad <ju...@wandisco.com>.
On Tue, 2010-08-10, C. Michael Pilato wrote:
> Per the commit's log message:
> 
> On 08/10/2010 09:38 PM, cmpilato@apache.org wrote:
> > Author: cmpilato
> > Date: Wed Aug 11 01:38:40 2010
> > New Revision: 984280
> 
> [...]
> 
> > NOTE:  The test suite changes brought in by this merge require
> > modifications to developers' httpd.conf files.  So if you see the
> > redirect_tests.py all failing, make sure you've updated your Apache
> > configuration per the instructions in the
> > subversion/tests/cmdline/README file.

In r984365 I've updated davautocheck.sh to load mod_alias which is
required for these RedirectMatch directives.

- Julian


Re: NOTICE: Testing over ra-dav has changed in trunk!!

Posted by Julian Foad <ju...@wandisco.com>.
On Tue, 2010-08-10, C. Michael Pilato wrote:
> Per the commit's log message:
> 
> On 08/10/2010 09:38 PM, cmpilato@apache.org wrote:
> > Author: cmpilato
> > Date: Wed Aug 11 01:38:40 2010
> > New Revision: 984280
> 
> [...]
> 
> > NOTE:  The test suite changes brought in by this merge require
> > modifications to developers' httpd.conf files.  So if you see the
> > redirect_tests.py all failing, make sure you've updated your Apache
> > configuration per the instructions in the
> > subversion/tests/cmdline/README file.

In r984365 I've updated davautocheck.sh to load mod_alias which is
required for these RedirectMatch directives.

- Julian



NOTICE: Testing over ra-dav has changed in trunk!!

Posted by "C. Michael Pilato" <cm...@collab.net>.
Per the commit's log message:

On 08/10/2010 09:38 PM, cmpilato@apache.org wrote:
> Author: cmpilato
> Date: Wed Aug 11 01:38:40 2010
> New Revision: 984280

[...]

> NOTE:  The test suite changes brought in by this merge require
> modifications to developers' httpd.conf files.  So if you see the
> redirect_tests.py all failing, make sure you've updated your Apache
> configuration per the instructions in the
> subversion/tests/cmdline/README file.

Enjoy!

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

NOTICE: Testing over ra-dav has changed in trunk!!

Posted by "C. Michael Pilato" <cm...@collab.net>.
Per the commit's log message:

On 08/10/2010 09:38 PM, cmpilato@apache.org wrote:
> Author: cmpilato
> Date: Wed Aug 11 01:38:40 2010
> New Revision: 984280

[...]

> NOTE:  The test suite changes brought in by this merge require
> modifications to developers' httpd.conf files.  So if you see the
> redirect_tests.py all failing, make sure you've updated your Apache
> configuration per the instructions in the
> subversion/tests/cmdline/README file.

Enjoy!

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand