Author: stsp
Date: Wed Mar 25 09:54:07 2020
New Revision: 1875619

URL: http://svn.apache.org/viewvc?rev=1875619&view=rev
Log:
Update svn_ra_open4() to svn_ra_open5() across the tree.

Most of these changes are mechanical. JavaHL gains a redirect cycle fix.
The set_svn_ra_open() callback gets updated to the new API.

* subversion/bindings/javahl/native/CommitEditor.cpp
  (open_callback_session): Use svn_ra_open5() and show the redirected URL in
   an error message.

* subversion/bindings/javahl/native/RemoteSession.cpp
  (RemoteSession::RemoteSession): Use svn_ra_open5() and detect redirect
   cycles based on the actual redirection URL sent by the server.

* subversion/libsvn_client/ra.c
  (svn_client__open_ra_session_internal): Use svn_ra_open5().

* subversion/libsvn_ra/ra_loader.c
  (svn_ra_open5): Pass svn_ra_open5 to the svn_svn_ra_open() callback.

* subversion/libsvn_ra/ra_loader.h
  (svn_ra__open_func_t): Update to match svn_ra_open5().

* subversion/libsvn_ra_serf/serf.c
  (svn_ra_serf__open): Update comment referring to svn_ra_open4().

* subversion/svnsync/svnsync.c
  (do_initialize, open_source_session,
   open_target_session): Update to svn_ra_open5().

* subversion/tests/cmdline/atomic-ra-revprop-change.c
  (change_rev_prop): Update to svn_ra_open5().

* subversion/tests/libsvn_ra/ra-test.c
  (make_and_open_repos, check_tunnel_callback_test, tunnel_callback_test,
  tunnel_run_checkout, commit_locked_file): Update to svn_ra_open5().

Modified:
    subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp
    subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp
    subversion/trunk/subversion/libsvn_client/ra.c
    subversion/trunk/subversion/libsvn_ra/ra_loader.c
    subversion/trunk/subversion/libsvn_ra/ra_loader.h
    subversion/trunk/subversion/libsvn_ra_serf/serf.c
    subversion/trunk/subversion/svnsync/svnsync.c
    subversion/trunk/subversion/tests/cmdline/atomic-ra-revprop-change.c
    subversion/trunk/subversion/tests/libsvn_ra/ra-test.c

Modified: subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp?rev=1875619&r1=1875618&r2=1875619&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp 
(original)
+++ subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp Wed Mar 
25 09:54:07 2020
@@ -444,7 +444,8 @@ svn_error_t* open_callback_session(svn_r
   if (!session)
     {
       const char* corrected_url = NULL;
-      SVN_ERR(svn_ra_open4(&session, &corrected_url, url, uuid,
+      const char* redirect_url = NULL;
+      SVN_ERR(svn_ra_open5(&session, &corrected_url, &redirect_url, url, uuid,
                            context->getCallbacks(),
                            context->getCallbackBaton(),
                            context->getConfigData(),
@@ -459,8 +460,8 @@ svn_error_t* open_callback_session(svn_r
           return svn_error_createf(
               SVN_ERR_RA_ILLEGAL_URL, NULL,
               _("Repository URL changed while session was open.\n"
-                "Expected URL: %s\nApparent URL: %s"),
-              url, corrected_url);
+                "Expected URL: %s\nRedirect URL:%s\nApparent URL: %s\n"),
+              url, redirect_url, corrected_url);
         }
     }
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp?rev=1875619&r1=1875618&r2=1875619&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp 
(original)
+++ subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp Wed 
Mar 25 09:54:07 2020
@@ -198,13 +198,14 @@ RemoteSession::RemoteSession(int retryAt
     return;
 
   const char* corrected_url = NULL;
+  const char* redirect_url = NULL;
   bool cycle_detected = false;
   attempt_set attempted;
 
   while (retryAttempts-- >= 0)
     {
       SVN_JNI_ERR(
-          svn_ra_open4(&m_session, &corrected_url,
+          svn_ra_open5(&m_session, &corrected_url, &redirect_url,
                        url, uuid, m_context->getCallbacks(),
                        m_context->getCallbackBaton(),
                        m_context->getConfigData(),
@@ -214,7 +215,7 @@ RemoteSession::RemoteSession(int retryAt
       if (!corrected_url)
         break;
 
-      attempt_insert result = attempted.insert(corrected_url);
+      attempt_insert result = attempted.insert(redirect_url);
       if (!result.second)
         {
           cycle_detected = true;

Modified: subversion/trunk/subversion/libsvn_client/ra.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/ra.c?rev=1875619&r1=1875618&r2=1875619&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/ra.c (original)
+++ subversion/trunk/subversion/libsvn_client/ra.c Wed Mar 25 09:54:07 2020
@@ -463,7 +463,7 @@ svn_client__open_ra_session_internal(svn
     }
   else
     {
-      SVN_ERR(svn_ra_open4(ra_session, NULL, base_url,
+      SVN_ERR(svn_ra_open5(ra_session, NULL, NULL, base_url,
                            uuid, cbtable, cb, ctx->config, result_pool));
     }
 

Modified: subversion/trunk/subversion/libsvn_ra/ra_loader.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/ra_loader.c?rev=1875619&r1=1875618&r2=1875619&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/trunk/subversion/libsvn_ra/ra_loader.c Wed Mar 25 09:54:07 2020
@@ -414,7 +414,7 @@ svn_error_t *svn_ra_open5(svn_ra_session
     }
 
   if (vtable->set_svn_ra_open)
-    SVN_ERR(vtable->set_svn_ra_open(session, svn_ra_open4));
+    SVN_ERR(vtable->set_svn_ra_open(session, svn_ra_open5));
 
   /* Check the UUID. */
   if (uuid)
@@ -475,7 +475,7 @@ svn_ra__dup_session(svn_ra_session_t **n
                                            scratch_pool));
 
   if (session->vtable->set_svn_ra_open)
-    SVN_ERR(session->vtable->set_svn_ra_open(session, svn_ra_open4));
+    SVN_ERR(session->vtable->set_svn_ra_open(session, svn_ra_open5));
 
   *new_session = session;
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_ra/ra_loader.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/ra_loader.h?rev=1875619&r1=1875618&r2=1875619&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/ra_loader.h (original)
+++ subversion/trunk/subversion/libsvn_ra/ra_loader.h Wed Mar 25 09:54:07 2020
@@ -42,6 +42,7 @@ extern "C" {
    handed to the ra api to allow opening other ra sessions. */
 typedef svn_error_t * (*svn_ra__open_func_t)(svn_ra_session_t **session_p,
                                               const char **corrected_url,
+                                              const char **redirect_url,
                                               const char *repos_URL,
                                               const char *uuid,
                                               const svn_ra_callbacks2_t 
*callbacks,

Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=1875619&r1=1875618&r2=1875619&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Wed Mar 25 09:54:07 2020
@@ -591,7 +591,7 @@ svn_ra_serf__open(svn_ra_session_t *sess
      Luckily our caller now passes us two pools which handle this case.
    */
 #if defined(SVN_DEBUG) && !SERF_VERSION_AT_LEAST(1,4,0)
-  /* Currently ensured by svn_ra_open4().
+  /* Currently ensured by svn_ra_open5().
      If failing causes segfault in basic_tests.py 48, "basic auth test" */
   SVN_ERR_ASSERT((serf_sess->pool != scratch_pool)
                  && apr_pool_is_ancestor(serf_sess->pool, scratch_pool));

Modified: subversion/trunk/subversion/svnsync/svnsync.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnsync/svnsync.c?rev=1875619&r1=1875618&r2=1875619&view=diff
==============================================================================
--- subversion/trunk/subversion/svnsync/svnsync.c (original)
+++ subversion/trunk/subversion/svnsync/svnsync.c Wed Mar 25 09:54:07 2020
@@ -821,7 +821,7 @@ do_initialize(svn_ra_session_t *to_sessi
 
   /* Now fill in our bookkeeping info in the dest repository. */
 
-  SVN_ERR(svn_ra_open4(&from_session, NULL, baton->from_url, NULL,
+  SVN_ERR(svn_ra_open5(&from_session, NULL, NULL, baton->from_url, NULL,
                        &(baton->source_callbacks), baton,
                        baton->config, pool));
   SVN_ERR(svn_ra_get_repos_root2(from_session, &root_url, pool));
@@ -998,7 +998,7 @@ open_source_session(svn_ra_session_t **f
                                           pool));
 
   /* Open the session to copy the revision data. */
-  SVN_ERR(svn_ra_open4(from_session, NULL, from_url, from_uuid_str->data,
+  SVN_ERR(svn_ra_open5(from_session, NULL, NULL, from_url, from_uuid_str->data,
                        callbacks, baton, config, pool));
 
   return SVN_NO_ERROR;
@@ -1013,7 +1013,7 @@ open_target_session(svn_ra_session_t **t
                     apr_pool_t *pool)
 {
   svn_ra_session_t *target_session;
-  SVN_ERR(svn_ra_open4(&target_session, NULL, baton->to_url, NULL,
+  SVN_ERR(svn_ra_open5(&target_session, NULL, NULL, baton->to_url, NULL,
                        &(baton->sync_callbacks), baton, baton->config, pool));
   SVN_ERR(check_if_session_is_at_repos_root(target_session, baton->to_url, 
pool));
 

Modified: subversion/trunk/subversion/tests/cmdline/atomic-ra-revprop-change.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/atomic-ra-revprop-change.c?rev=1875619&r1=1875618&r2=1875619&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/atomic-ra-revprop-change.c 
(original)
+++ subversion/trunk/subversion/tests/cmdline/atomic-ra-revprop-change.c Wed 
Mar 25 09:54:07 2020
@@ -99,8 +99,8 @@ change_rev_prop(const char *url,
   SVN_ERR(construct_auth_baton(&callbacks->auth_baton, config_dir, pool));
   SVN_ERR(construct_config(&config, config_dir, pool));
 
-  SVN_ERR(svn_ra_open4(&sess, NULL, url, NULL, callbacks, NULL /* baton */,
-                       config, pool));
+  SVN_ERR(svn_ra_open5(&sess, NULL, NULL, url, NULL,
+                       callbacks, NULL /* baton */, config, pool));
 
   SVN_ERR(svn_ra_has_capability(sess, &capable,
                                 SVN_RA_CAPABILITY_ATOMIC_REVPROPS,

Modified: subversion/trunk/subversion/tests/libsvn_ra/ra-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_ra/ra-test.c?rev=1875619&r1=1875618&r2=1875619&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_ra/ra-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_ra/ra-test.c Wed Mar 25 09:54:07 
2020
@@ -62,7 +62,8 @@ make_and_open_repos(svn_ra_session_t **s
                                   pool, pool));
   SVN_ERR(svn_ra_initialize(pool));
 
-  SVN_ERR(svn_ra_open4(session, NULL, url, NULL, cbtable, NULL, NULL, pool));
+  SVN_ERR(svn_ra_open5(session, NULL, NULL, url, NULL, cbtable, NULL, NULL,
+                       pool));
 
   return SVN_NO_ERROR;
 }
@@ -387,7 +388,7 @@ check_tunnel_callback_test(const svn_tes
                                          NULL, NULL, NULL, pool));
 
   b->last_check = TRUE;
-  SVN_TEST_ASSERT_ERROR(svn_ra_open4(&session, NULL,
+  SVN_TEST_ASSERT_ERROR(svn_ra_open5(&session, NULL, NULL,
                                      "svn+foo://localhost/no-repo",
                                      NULL, cbtable, NULL, NULL, pool),
                         SVN_ERR_RA_CANNOT_CREATE_SESSION);
@@ -430,7 +431,7 @@ tunnel_callback_test(const svn_test_opts
                                          NULL, NULL, NULL, pool));
 
   b->last_check = FALSE;
-  SVN_ERR(svn_ra_open4(&session, NULL, url, NULL, cbtable, NULL, NULL,
+  SVN_ERR(svn_ra_open5(&session, NULL, NULL, url, NULL, cbtable, NULL, NULL,
                         scratch_pool));
   SVN_TEST_ASSERT(b->last_check);
   SVN_TEST_ASSERT(b->open_count > 0);
@@ -1591,7 +1592,7 @@ tunnel_run_checkout(const svn_test_opts_
 
   b->last_check = FALSE;
 
-  SVN_ERR(svn_ra_open4(&session, NULL, url, NULL, cbtable, NULL, NULL,
+  SVN_ERR(svn_ra_open5(&session, NULL, NULL, url, NULL, cbtable, NULL, NULL,
                        scratch_pool));
 
   SVN_ERR(commit_changes(session, pool));
@@ -1733,7 +1734,7 @@ commit_locked_file(const svn_test_opts_t
   SVN_ERR(svn_ra_create_callbacks(&cbtable, pool));
   SVN_ERR(svn_test__init_auth_baton(&cbtable->auth_baton, pool));
 
-  SVN_ERR(svn_ra_open4(&session, NULL, url, NULL, cbtable,
+  SVN_ERR(svn_ra_open5(&session, NULL, NULL, url, NULL, cbtable,
                        NULL, NULL, pool));
   SVN_ERR(svn_ra_get_commit_editor3(session, &editor, &edit_baton,
                                     apr_hash_make(pool),
@@ -1766,7 +1767,7 @@ commit_locked_file(const svn_test_opts_t
   }
 
   /* Open a new session using the file parent's URL. */
-  SVN_ERR(svn_ra_open4(&session, NULL, url, NULL, cbtable,
+  SVN_ERR(svn_ra_open5(&session, NULL, NULL, url, NULL, cbtable,
                        NULL, NULL, pool));
 
   /* Create a new commit editor supplying our lock token. */


Reply via email to