You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2013/06/12 13:24:58 UTC

svn commit: r1492148 - in /subversion/trunk/subversion: include/private/svn_ra_private.h libsvn_ra/ra_loader.c libsvn_ra/util.c

Author: danielsh
Date: Wed Jun 12 11:24:57 2013
New Revision: 1492148

URL: http://svn.apache.org/r1492148
Log:
Don't try to request reverse blame ranges from servers that won't understand
this (and may try to process the request anyway rather than gracefully error on
it).

* subversion/include/private/svn_ra_private.h
  (svn_ra__assert_capable_server): New.
  (svn_ra__assert_mergeinfo_capable_server): Redocument.

* subversion/libsvn_ra/ra_loader.c
  (svn_ra_get_file_revs2): Ensure the server supports reverse ranges, if our
    range is such.

* subversion/libsvn_ra/util.c
  (svn_ra__assert_capable_server): New.

Modified:
    subversion/trunk/subversion/include/private/svn_ra_private.h
    subversion/trunk/subversion/libsvn_ra/ra_loader.c
    subversion/trunk/subversion/libsvn_ra/util.c

Modified: subversion/trunk/subversion/include/private/svn_ra_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_ra_private.h?rev=1492148&r1=1492147&r2=1492148&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_ra_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_ra_private.h Wed Jun 12 11:24:57 2013
@@ -39,15 +39,23 @@
 extern "C" {
 #endif /* __cplusplus */
 
-/* Return an error with code SVN_ERR_UNSUPPORTED_FEATURE, and an error
-   message referencing PATH_OR_URL, if the "server" pointed to by
-   RA_SESSION doesn't support Merge Tracking (e.g. is pre-1.5).
-   Perform temporary allocations in POOL. */
+/* Equivalent to svn_ra__assert_capable_server()
+   for SVN_RA_CAPABILITY_MERGEINFO. */
 svn_error_t *
 svn_ra__assert_mergeinfo_capable_server(svn_ra_session_t *ra_session,
                                         const char *path_or_url,
                                         apr_pool_t *pool);
 
+/* Return an error with code SVN_ERR_UNSUPPORTED_FEATURE, and an error
+   message referencing PATH_OR_URL, if the "server" pointed to by
+   RA_SESSION doesn't support CAPABILITY (an SVN_RA_CAPABILITY_* constant).
+   Perform temporary allocations in POOL. */
+svn_error_t *
+svn_ra__assert_capable_server(svn_ra_session_t *ra_session,
+                              const char *capability,
+                              const char *path_or_url,
+                              apr_pool_t *pool);
+
 
 /*** Operational Locks ***/
 

Modified: subversion/trunk/subversion/libsvn_ra/ra_loader.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/ra_loader.c?rev=1492148&r1=1492147&r2=1492148&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/trunk/subversion/libsvn_ra/ra_loader.c Wed Jun 12 11:24:57 2013
@@ -1030,6 +1030,13 @@ svn_error_t *svn_ra_get_file_revs2(svn_r
   if (include_merged_revisions)
     SVN_ERR(svn_ra__assert_mergeinfo_capable_server(session, NULL, pool));
 
+  if (start > end)
+    SVN_ERR(
+     svn_ra__assert_capable_server(session,
+                                   SVN_RA_CAPABILITY_GET_FILE_REVS_REVERSE,
+                                   NULL,
+                                   pool));
+
   err = session->vtable->get_file_revs(session, path, start, end,
                                        include_merged_revisions,
                                        handler, handler_baton, pool);

Modified: subversion/trunk/subversion/libsvn_ra/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/util.c?rev=1492148&r1=1492147&r2=1492148&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra/util.c Wed Jun 12 11:24:57 2013
@@ -69,6 +69,31 @@ svn_ra__assert_mergeinfo_capable_server(
   return SVN_NO_ERROR;
 }
 
+svn_error_t *
+svn_ra__assert_capable_server(svn_ra_session_t *ra_session,
+                              const char *capability,
+                              const char *path_or_url,
+                              apr_pool_t *pool)
+{
+  if (!strcmp(capability, SVN_RA_CAPABILITY_GET_FILE_REVS_REVERSE))
+    return svn_ra__assert_mergeinfo_capable_server(ra_session, path_or_url,
+                                                   pool);
+
+  else
+    {
+      svn_boolean_t has;
+      SVN_ERR(svn_ra_has_capability(ra_session, &has, capability, pool));
+      if (! has)
+        return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+                               _("The '%s' feature is not supported by '%s'"),
+                               capability,
+                               svn_path_is_url(path_or_url)
+                                  ? path_or_url
+                                  : svn_dirent_local_style(path_or_url, pool));
+    }
+  return SVN_NO_ERROR;
+}
+
 /* Does ERR mean "the current value of the revprop isn't equal to
    the *OLD_VALUE_P you gave me"?
  */