You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/11/30 11:24:23 UTC

svn commit: r1717223 [35/50] - in /subversion/branches/ra-git: ./ build/ build/ac-macros/ build/generator/ build/generator/templates/ contrib/hook-scripts/ notes/ notes/api-errata/1.9/ notes/move-tracking/ subversion/ subversion/bindings/ctypes-python/...

Modified: subversion/branches/ra-git/subversion/mod_dav_svn/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/mod_dav_svn/lock.c?rev=1717223&r1=1717222&r2=1717223&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/mod_dav_svn/lock.c (original)
+++ subversion/branches/ra-git/subversion/mod_dav_svn/lock.c Mon Nov 30 10:24:16 2015
@@ -147,7 +147,7 @@ unescape_xml(const char **output,
       errbuf[0] = '\0';
       (void)apr_xml_parser_geterror(xml_parser, errbuf, sizeof(errbuf));
       return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR,
-                                DAV_ERR_LOCK_SAVE_LOCK, errbuf);
+                                DAV_ERR_LOCK_SAVE_LOCK, apr_err, errbuf);
     }
 
   apr_xml_to_text(pool, xml_doc->root, APR_XML_X2T_INNER,
@@ -170,12 +170,12 @@ dav_lock_to_svn_lock(svn_lock_t **slock,
   /* Sanity checks */
   if (dlock->type != DAV_LOCKTYPE_WRITE)
     return dav_svn__new_error(pool, HTTP_BAD_REQUEST,
-                              DAV_ERR_LOCK_SAVE_LOCK,
+                              DAV_ERR_LOCK_SAVE_LOCK, 0,
                               "Only 'write' locks are supported.");
 
   if (dlock->scope != DAV_LOCKSCOPE_EXCLUSIVE)
     return dav_svn__new_error(pool, HTTP_BAD_REQUEST,
-                              DAV_ERR_LOCK_SAVE_LOCK,
+                              DAV_ERR_LOCK_SAVE_LOCK, 0,
                               "Only exclusive locks are supported.");
 
   lock = svn_lock_create(pool);
@@ -470,7 +470,7 @@ get_locks(dav_lockdb *lockdb,
   if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
                                      resource->pool))
     return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
-                              DAV_ERR_LOCK_SAVE_LOCK,
+                              DAV_ERR_LOCK_SAVE_LOCK, 0,
                               "Path is not accessible.");
 
   serr = svn_fs_get_lock(&slock,
@@ -487,6 +487,18 @@ get_locks(dav_lockdb *lockdb,
       svn_lock_to_dav_lock(&lock, slock, info->lock_break,
                            resource->exists, resource->pool);
 
+      /* If we are talking to an svn client that wants to unlock a
+         path, tell mod_dav that the lock is owned by the user trying
+         to unlock. This stops it from returning an error that we
+         can't use in the client, and allows us to return the actual
+         unlock error */
+      if (info->r->method_number == M_UNLOCK
+          && resource->info->repos->is_svn_client
+          && resource->info->repos->username)
+        {
+          lock->auth_user = resource->info->repos->username;
+        }
+
       /* Let svn clients know the creationdate of the slock. */
       apr_table_setn(info->r->headers_out, SVN_DAV_CREATIONDATE_HEADER,
                      svn_time_to_cstring(slock->creation_date,
@@ -531,7 +543,7 @@ find_lock(dav_lockdb *lockdb,
   if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
                                      resource->pool))
     return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
-                              DAV_ERR_LOCK_SAVE_LOCK,
+                              DAV_ERR_LOCK_SAVE_LOCK, 0,
                               "Path is not accessible.");
 
   serr = svn_fs_get_lock(&slock,
@@ -548,7 +560,7 @@ find_lock(dav_lockdb *lockdb,
       /* Sanity check. */
       if (strcmp(locktoken->uuid_str, slock->token) != 0)
         return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST,
-                                  DAV_ERR_LOCK_SAVE_LOCK,
+                                  DAV_ERR_LOCK_SAVE_LOCK, 0,
                                   "Incoming token doesn't match existing "
                                   "lock.");
 
@@ -612,7 +624,7 @@ has_locks(dav_lockdb *lockdb, const dav_
   if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
                                      resource->pool))
     return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
-                              DAV_ERR_LOCK_SAVE_LOCK,
+                              DAV_ERR_LOCK_SAVE_LOCK, 0,
                               "Path is not accessible.");
 
   serr = svn_fs_get_lock(&slock,
@@ -655,13 +667,13 @@ append_locks(dav_lockdb *lockdb,
   /* We don't allow anonymous locks */
   if (! repos->username)
     return dav_svn__new_error(resource->pool, HTTP_NOT_IMPLEMENTED,
-                              DAV_ERR_LOCK_SAVE_LOCK,
+                              DAV_ERR_LOCK_SAVE_LOCK, 0,
                               "Anonymous lock creation is not allowed.");
 
   /* Not a path in the repository so can't lock it. */
   if (! resource->info->repos_path)
     return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST,
-                              DAV_ERR_LOCK_SAVE_LOCK,
+                              DAV_ERR_LOCK_SAVE_LOCK, 0,
                               "Attempted to lock path not in repository.");
 
   /* If the resource's fs path is unreadable, we don't allow a lock to
@@ -669,12 +681,12 @@ append_locks(dav_lockdb *lockdb,
   if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
                                      resource->pool))
     return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
-                              DAV_ERR_LOCK_SAVE_LOCK,
+                              DAV_ERR_LOCK_SAVE_LOCK, 0,
                               "Path is not accessible.");
 
   if (lock->next)
     return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST,
-                              DAV_ERR_LOCK_SAVE_LOCK,
+                              DAV_ERR_LOCK_SAVE_LOCK, 0,
                               "Tried to attach multiple locks to a resource.");
 
   /* RFC2518bis (section 7.4) doesn't require us to support
@@ -693,13 +705,13 @@ append_locks(dav_lockdb *lockdb,
 
       if (resource->info->repos->is_svn_client)
         return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED,
-                                  DAV_ERR_LOCK_SAVE_LOCK,
+                                  DAV_ERR_LOCK_SAVE_LOCK, 0,
                                   "Subversion clients may not lock "
                                   "nonexistent paths.");
 
       else if (! resource->info->repos->autoversioning)
         return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED,
-                                  DAV_ERR_LOCK_SAVE_LOCK,
+                                  DAV_ERR_LOCK_SAVE_LOCK, 0,
                                   "Attempted to lock non-existent path; "
                                   "turn on autoversioning first.");
 
@@ -755,7 +767,7 @@ append_locks(dav_lockdb *lockdb,
           else
             return dav_svn__new_error(resource->pool,
                                       HTTP_INTERNAL_SERVER_ERROR,
-                                      0,
+                                      0, 0,
                                       "Commit failed but there was no error "
                                       "provided.");
         }
@@ -784,7 +796,7 @@ append_locks(dav_lockdb *lockdb,
     {
       svn_error_clear(serr);
       return dav_svn__new_error(resource->pool, HTTP_NOT_IMPLEMENTED,
-                                DAV_ERR_LOCK_SAVE_LOCK,
+                                DAV_ERR_LOCK_SAVE_LOCK, 0,
                                 "Anonymous lock creation is not allowed.");
     }
   else if (serr && serr->apr_err == SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED)
@@ -881,7 +893,7 @@ remove_lock(dav_lockdb *lockdb,
   if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
                                      resource->pool))
     return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
-                              DAV_ERR_LOCK_SAVE_LOCK,
+                              DAV_ERR_LOCK_SAVE_LOCK, 0,
                               "Path is not accessible.");
 
   if (locktoken == NULL)
@@ -918,7 +930,7 @@ remove_lock(dav_lockdb *lockdb,
         {
           svn_error_clear(serr);
           return dav_svn__new_error(resource->pool, HTTP_NOT_IMPLEMENTED,
-                                    DAV_ERR_LOCK_SAVE_LOCK,
+                                    DAV_ERR_LOCK_SAVE_LOCK, 0,
                                     "Anonymous lock removal is not allowed.");
         }
       else if (serr && serr->apr_err == SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED
@@ -937,6 +949,11 @@ remove_lock(dav_lockdb *lockdb,
                            APLOG_WARNING);
 
         }
+      else if (serr && serr->apr_err == SVN_ERR_FS_LOCK_OWNER_MISMATCH)
+        {
+            return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
+                                        NULL, resource->pool);
+        }
       else if (serr)
         return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
                                     "Failed to remove a lock.",
@@ -1014,7 +1031,7 @@ refresh_locks(dav_lockdb *lockdb,
   if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
                                      resource->pool))
     return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
-                              DAV_ERR_LOCK_SAVE_LOCK,
+                              DAV_ERR_LOCK_SAVE_LOCK, 0,
                               "Path is not accessible.");
 
   /* Convert the path into an svn_lock_t. */
@@ -1032,7 +1049,7 @@ refresh_locks(dav_lockdb *lockdb,
   if ((! slock)
       || (strcmp(token->uuid_str, slock->token) != 0))
     return dav_svn__new_error(resource->pool, HTTP_PRECONDITION_FAILED,
-                              DAV_ERR_LOCK_SAVE_LOCK,
+                              DAV_ERR_LOCK_SAVE_LOCK, 0,
                               "Lock refresh request doesn't match existing "
                               "lock.");
 
@@ -1053,7 +1070,7 @@ refresh_locks(dav_lockdb *lockdb,
     {
       svn_error_clear(serr);
       return dav_svn__new_error(resource->pool, HTTP_NOT_IMPLEMENTED,
-                                DAV_ERR_LOCK_SAVE_LOCK,
+                                DAV_ERR_LOCK_SAVE_LOCK, 0,
                                 "Anonymous lock refreshing is not allowed.");
     }
   else if (serr && (svn_error_find_cause(serr, SVN_ERR_REPOS_HOOK_FAILURE) ||

Modified: subversion/branches/ra-git/subversion/mod_dav_svn/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/mod_dav_svn/merge.c?rev=1717223&r1=1717222&r2=1717223&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/mod_dav_svn/merge.c (original)
+++ subversion/branches/ra-git/subversion/mod_dav_svn/merge.c Mon Nov 30 10:24:16 2015
@@ -268,16 +268,16 @@ dav_svn__merge_response(ap_filter_t *out
 
 
   /* get the creationdate and creator-displayname of the new revision, too. */
-  serr = svn_fs_revision_prop(&creationdate, repos->fs, new_rev,
-                              SVN_PROP_REVISION_DATE, pool);
+  serr = svn_fs_revision_prop2(&creationdate, repos->fs, new_rev,
+                               SVN_PROP_REVISION_DATE, TRUE, pool, pool);
   if (serr != NULL)
     {
       return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
                                   "Could not get date of newest revision",
                                   repos->pool);
     }
-  serr = svn_fs_revision_prop(&creator_displayname, repos->fs, new_rev,
-                              SVN_PROP_REVISION_AUTHOR, pool);
+  serr = svn_fs_revision_prop2(&creator_displayname, repos->fs, new_rev,
+                               SVN_PROP_REVISION_AUTHOR, TRUE, pool, pool);
   if (serr != NULL)
     {
       return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
@@ -307,7 +307,8 @@ dav_svn__merge_response(ap_filter_t *out
                      "<D:version-name>", rev, "</D:version-name>" DEBUG_CR,
                      NULL);
   if (status != APR_SUCCESS)
-    return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+    return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR,
+                              0, status,
                               "Could not write output");
 
   if (creationdate)
@@ -318,7 +319,8 @@ dav_svn__merge_response(ap_filter_t *out
                          "</D:creationdate>" DEBUG_CR,
                          NULL);
       if (status != APR_SUCCESS)
-        return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+        return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR,
+                                  0, status,
                                   "Could not write output");
     }
   if (creator_displayname)
@@ -330,7 +332,8 @@ dav_svn__merge_response(ap_filter_t *out
                          "</D:creator-displayname>" DEBUG_CR,
                          NULL);
       if (status != APR_SUCCESS)
-        return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+        return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR,
+                                  0, status,
                                   "Could not write output");
     }
   status = ap_fputstrs(output, bb,
@@ -341,7 +344,8 @@ dav_svn__merge_response(ap_filter_t *out
 
                      NULL);
   if (status != APR_SUCCESS)
-    return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+    return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR,
+                              0, status,
                               "Could not write output");
 
   /* ONLY have dir_delta drive the editor if the caller asked us to
@@ -375,13 +379,15 @@ dav_svn__merge_response(ap_filter_t *out
                   "</D:updated-set>" DEBUG_CR
                   "</D:merge-response>" DEBUG_CR);
   if (status != APR_SUCCESS)
-    return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+    return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR,
+                              0, status,
                               "Could not write output");
 
   /* send whatever is left in the brigade */
   status = ap_pass_brigade(output, bb);
   if (status != APR_SUCCESS)
-    return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+    return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR,
+                              0, status,
                               "Could not write output");
 
   return NULL;

Modified: subversion/branches/ra-git/subversion/mod_dav_svn/reports/dated-rev.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/mod_dav_svn/reports/dated-rev.c?rev=1717223&r1=1717222&r2=1717223&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/mod_dav_svn/reports/dated-rev.c (original)
+++ subversion/branches/ra-git/subversion/mod_dav_svn/reports/dated-rev.c Mon Nov 30 10:24:16 2015
@@ -80,7 +80,7 @@ dav_svn__dated_rev_report(const dav_reso
 
   if (tm == (apr_time_t) -1)
     {
-      return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+      return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                 "The request does not contain a valid "
                                 "'DAV:" SVN_DAV__CREATIONDATE "' element.");
     }
@@ -90,7 +90,8 @@ dav_svn__dated_rev_report(const dav_reso
                                       resource->pool)) != SVN_NO_ERROR)
     {
       svn_error_clear(err);
-      return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+      return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR,
+                                0, 0,
                                 "Could not access revision times.");
     }
 

Modified: subversion/branches/ra-git/subversion/mod_dav_svn/reports/deleted-rev.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/mod_dav_svn/reports/deleted-rev.c?rev=1717223&r1=1717222&r2=1717223&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/mod_dav_svn/reports/deleted-rev.c (original)
+++ subversion/branches/ra-git/subversion/mod_dav_svn/reports/deleted-rev.c Mon Nov 30 10:24:16 2015
@@ -57,11 +57,11 @@ dav_svn__get_deleted_rev_report(const da
 
   /* Sanity check. */
   if (!resource->info->repos_path)
-    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                               "The request does not specify a repository path");
   ns = dav_svn__find_ns(doc->namespaces, SVN_XML_NAMESPACE);
   if (ns == -1)
-    return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                   "The request does not contain the 'svn:' "
                                   "namespace, so it is not going to have "
                                   "certain required elements");
@@ -102,7 +102,7 @@ dav_svn__get_deleted_rev_report(const da
          && SVN_IS_VALID_REVNUM(peg_rev)
          && SVN_IS_VALID_REVNUM(end_rev)))
     {
-      return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+      return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                     "Not all parameters passed");
     }
 
@@ -113,7 +113,8 @@ dav_svn__get_deleted_rev_report(const da
   if (err)
     {
       svn_error_clear(err);
-      return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+      return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR,
+                                0, 0,
                                 "Could not find revision path was deleted.");
     }
 

Modified: subversion/branches/ra-git/subversion/mod_dav_svn/reports/file-revs.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/mod_dav_svn/reports/file-revs.c?rev=1717223&r1=1717222&r2=1717223&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/mod_dav_svn/reports/file-revs.c (original)
+++ subversion/branches/ra-git/subversion/mod_dav_svn/reports/file-revs.c Mon Nov 30 10:24:16 2015
@@ -255,14 +255,14 @@ dav_svn__file_revs_report(const dav_reso
 
   /* Sanity check. */
   if (!resource->info->repos_path)
-    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                               "The request does not specify a repository path");
   ns = dav_svn__find_ns(doc->namespaces, SVN_XML_NAMESPACE);
   /* ### This is done on other places, but the document element is
      in this namespace, so is this necessary at all? */
   if (ns == -1)
     {
-      return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+      return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                     "The request does not contain the 'svn:' "
                                     "namespace, so it is not going to have "
                                     "certain required elements");
@@ -300,7 +300,7 @@ dav_svn__file_revs_report(const dav_reso
 
   /* Check that all parameters are present and valid. */
   if (! abs_path)
-    return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                   "Not all parameters passed");
 
   frb.bb = apr_brigade_create(resource->pool,

Modified: subversion/branches/ra-git/subversion/mod_dav_svn/reports/get-location-segments.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/mod_dav_svn/reports/get-location-segments.c?rev=1717223&r1=1717222&r2=1717223&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/mod_dav_svn/reports/get-location-segments.c (original)
+++ subversion/branches/ra-git/subversion/mod_dav_svn/reports/get-location-segments.c Mon Nov 30 10:24:16 2015
@@ -124,12 +124,12 @@ dav_svn__get_location_segments_report(co
 
   /* Sanity check. */
   if (!resource->info->repos_path)
-    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                               "The request does not specify a repository path");
   ns = dav_svn__find_ns(doc->namespaces, SVN_XML_NAMESPACE);
   if (ns == -1)
     {
-      return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+      return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                     "The request does not contain the 'svn:' "
                                     "namespace, so it is not going to have "
                                     "certain required elements");
@@ -175,18 +175,39 @@ dav_svn__get_location_segments_report(co
 
   /* Check that all parameters are present and valid. */
   if (! abs_path)
-    return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                   "Not all parameters passed");
-  if (SVN_IS_VALID_REVNUM(start_rev)
-      && SVN_IS_VALID_REVNUM(end_rev)
-      && (end_rev > start_rev))
-    return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+
+  /* No START_REV or PEG_REVISION?  We'll use HEAD. */
+  if (!SVN_IS_VALID_REVNUM(start_rev) || !SVN_IS_VALID_REVNUM(peg_revision))
+    {
+      svn_revnum_t youngest;
+
+      serr = svn_fs_youngest_rev(&youngest, resource->info->repos->fs,
+                                 resource->pool);
+      if (serr != NULL)
+        return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
+                                    "Could not determine youngest revision",
+                                    resource->pool);
+
+      if (!SVN_IS_VALID_REVNUM(start_rev))
+        start_rev = youngest;
+      if (!SVN_IS_VALID_REVNUM(peg_revision))
+        peg_revision = youngest;
+    }
+
+  /* No END_REV?  We'll use 0. */
+  if (!SVN_IS_VALID_REVNUM(end_rev))
+    end_rev = 0;
+
+  if (end_rev > start_rev)
+    return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST,
+                                  SVN_ERR_FS_NO_SUCH_REVISION, 0,
                                   "End revision must not be younger than "
                                   "start revision");
-  if (SVN_IS_VALID_REVNUM(peg_revision)
-      && SVN_IS_VALID_REVNUM(start_rev)
-      && (start_rev > peg_revision))
-    return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+  if (start_rev > peg_revision)
+    return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST,
+                                  SVN_ERR_FS_NO_SUCH_REVISION, 0,
                                   "Start revision must not be younger than "
                                   "peg revision");
 

Modified: subversion/branches/ra-git/subversion/mod_dav_svn/reports/get-locations.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/mod_dav_svn/reports/get-locations.c?rev=1717223&r1=1717222&r2=1717223&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/mod_dav_svn/reports/get-locations.c (original)
+++ subversion/branches/ra-git/subversion/mod_dav_svn/reports/get-locations.c Mon Nov 30 10:24:16 2015
@@ -107,12 +107,12 @@ dav_svn__get_locations_report(const dav_
 
   /* Sanity check. */
   if (!resource->info->repos_path)
-    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                               "The request does not specify a repository path");
   ns = dav_svn__find_ns(doc->namespaces, SVN_XML_NAMESPACE);
   if (ns == -1)
     {
-      return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+      return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                     "The request does not contain the 'svn:' "
                                     "namespace, so it is not going to have "
                                     "certain required elements");
@@ -152,7 +152,7 @@ dav_svn__get_locations_report(const dav_
 
   /* Check that all parameters are present and valid. */
   if (! (abs_path && SVN_IS_VALID_REVNUM(peg_revision)))
-    return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                   "Not all parameters passed");
 
   /* Build an authz read baton */

Modified: subversion/branches/ra-git/subversion/mod_dav_svn/reports/get-locks.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/mod_dav_svn/reports/get-locks.c?rev=1717223&r1=1717222&r2=1717223&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/mod_dav_svn/reports/get-locks.c (original)
+++ subversion/branches/ra-git/subversion/mod_dav_svn/reports/get-locks.c Mon Nov 30 10:24:16 2015
@@ -190,7 +190,7 @@ dav_svn__get_locks_report(const dav_reso
   /* The request URI should be a public one representing an fs path. */
   if ((! resource->info->repos_path)
       || (! resource->info->repos->repos))
-    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                               "get-locks-report run on resource which doesn't "
                               "represent a path within a repository.");
 
@@ -207,7 +207,7 @@ dav_svn__get_locks_report(const dav_reso
               (depth != svn_depth_files) &&
               (depth != svn_depth_immediates) &&
               (depth != svn_depth_infinity))
-            return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+            return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                       "Invalid 'depth' specified in "
                                       "get-locks-report request.");
           continue;

Modified: subversion/branches/ra-git/subversion/mod_dav_svn/reports/inherited-props.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/mod_dav_svn/reports/inherited-props.c?rev=1717223&r1=1717222&r2=1717223&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/mod_dav_svn/reports/inherited-props.c (original)
+++ subversion/branches/ra-git/subversion/mod_dav_svn/reports/inherited-props.c Mon Nov 30 10:24:16 2015
@@ -61,15 +61,16 @@ dav_svn__get_inherited_props_report(cons
   int i;
   svn_revnum_t rev = SVN_INVALID_REVNUM;
   apr_pool_t *iterpool;
+  svn_node_kind_t kind;
 
   /* Sanity check. */
   if (!resource->info->repos_path)
-    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                               "The request does not specify a repository path");
   ns = dav_svn__find_ns(doc->namespaces, SVN_XML_NAMESPACE);
   if (ns == -1)
     {
-      return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+      return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                     "The request does not contain the 'svn:' "
                                     "namespace, so it is not going to have "
                                     "certain required elements");
@@ -114,6 +115,20 @@ dav_svn__get_inherited_props_report(cons
                                 "couldn't retrieve revision root",
                                 resource->pool);
 
+  serr = svn_fs_check_path(&kind, root, path, resource->pool);
+  if (!serr && kind == svn_node_none)
+    {
+      serr = svn_error_createf(SVN_ERR_FS_NOT_FOUND, NULL,
+                               "'%s' path not found", path);
+    }
+
+  if (serr)
+    {
+      derr = dav_svn__convert_err(serr, HTTP_BAD_REQUEST, NULL,
+                                  resource->pool);
+      goto cleanup;
+    }
+
   serr = svn_repos_fs_get_inherited_props(&inherited_props, root, path, NULL,
                                           dav_svn__authz_read_func(&arb),
                                           &arb, resource->pool, iterpool);

Modified: subversion/branches/ra-git/subversion/mod_dav_svn/reports/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/mod_dav_svn/reports/log.c?rev=1717223&r1=1717222&r2=1717223&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/mod_dav_svn/reports/log.c (original)
+++ subversion/branches/ra-git/subversion/mod_dav_svn/reports/log.c Mon Nov 30 10:24:16 2015
@@ -65,6 +65,10 @@ struct log_receiver_baton
 
   /* whether the client can handle encoded binary property values */
   svn_boolean_t encode_binary_props;
+
+  /* Helper variables to force early bucket brigade flushes */
+  int result_count;
+  int next_forced_flush;
 };
 
 
@@ -282,6 +286,41 @@ log_receiver(void *baton,
   SVN_ERR(dav_svn__brigade_puts(lrb->bb, lrb->output,
                                 "</S:log-item>" DEBUG_CR));
 
+  /* In general APR will flush the brigade every 8000 bytes through the filter
+     stack, but log items may not be generated that fast, especially in
+     combination with authz and busy servers. We now explictly flush after
+     log-item 4, 16, 64 and 256 to produce a few results fast.
+
+     This introduces 4 full flushes of our brigade and the installed output
+     filters at growing intervals and then falls back to the standard
+     buffering of 8000 bytes + whatever buffers are added in output filters. */
+  lrb->result_count++;
+  if (lrb->result_count == lrb->next_forced_flush)
+    {
+      apr_status_t apr_err;
+
+      /* This flush is similar to that in dav_svn__final_flush_or_error().
+
+         Compared to using ap_filter_flush(), which we use in other place
+         this adds a flush frame before flushing the brigade, to make output
+         filters perform a flush as well */
+
+      /* No brigade empty check. We want output filters to flush anyway */
+      apr_err = ap_fflush(lrb->output, lrb->bb);
+      if (apr_err)
+        return svn_error_create(apr_err, NULL, NULL);
+
+      /* Check for an aborted connection, just like our brigade write
+         helper functions, since the brigade functions don't appear to
+         be return useful errors when the connection is dropped. */
+      if (lrb->output->c->aborted)
+        return svn_error_create(SVN_ERR_APMOD_CONNECTION_ABORTED,
+                                NULL, NULL);
+
+      if (lrb->result_count < 256)
+        lrb->next_forced_flush = lrb->next_forced_flush * 4;
+    }
+
   return SVN_NO_ERROR;
 }
 
@@ -316,12 +355,12 @@ dav_svn__log_report(const dav_resource *
 
   /* Sanity check. */
   if (!resource->info->repos_path)
-    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                               "The request does not specify a repository path");
   ns = dav_svn__find_ns(doc->namespaces, SVN_XML_NAMESPACE);
   if (ns == -1)
     {
-      return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+      return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                     "The request does not contain the 'svn:' "
                                     "namespace, so it is not going to have "
                                     "certain required elements");
@@ -427,6 +466,9 @@ dav_svn__log_report(const dav_resource *
   lrb.stack_depth = 0;
   /* lrb.requested_custom_revprops set above */
 
+  lrb.result_count = 0;
+  lrb.next_forced_flush = 4;
+
   /* Our svn_log_entry_receiver_t sends the <S:log-report> header in
      a lazy fashion.  Before writing the first log message, it assures
      that the header has already been sent (checking the needs_header

Modified: subversion/branches/ra-git/subversion/mod_dav_svn/reports/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/mod_dav_svn/reports/mergeinfo.c?rev=1717223&r1=1717222&r2=1717223&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/mod_dav_svn/reports/mergeinfo.c (original)
+++ subversion/branches/ra-git/subversion/mod_dav_svn/reports/mergeinfo.c Mon Nov 30 10:24:16 2015
@@ -68,12 +68,12 @@ dav_svn__get_mergeinfo_report(const dav_
 
   /* Sanity check. */
   if (!resource->info->repos_path)
-    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                               "The request does not specify a repository path");
   ns = dav_svn__find_ns(doc->namespaces, SVN_XML_NAMESPACE);
   if (ns == -1)
     {
-      return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+      return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                     "The request does not contain the 'svn:' "
                                     "namespace, so it is not going to have "
                                     "certain required elements");

Modified: subversion/branches/ra-git/subversion/mod_dav_svn/reports/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/mod_dav_svn/reports/replay.c?rev=1717223&r1=1717222&r2=1717223&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/mod_dav_svn/reports/replay.c (original)
+++ subversion/branches/ra-git/subversion/mod_dav_svn/reports/replay.c Mon Nov 30 10:24:16 2015
@@ -401,7 +401,7 @@ make_editor(const svn_delta_editor_t **e
 static dav_error *
 malformed_element_error(const char *tagname, apr_pool_t *pool)
 {
-  return dav_svn__new_error_svn(pool, HTTP_BAD_REQUEST, 0,
+  return dav_svn__new_error_svn(pool, HTTP_BAD_REQUEST, 0, 0,
                                 apr_pstrcat(pool,
                                             "The request's '", tagname,
                                             "' element is malformed; there "
@@ -455,7 +455,7 @@ dav_svn__replay_report(const dav_resourc
 
   ns = dav_svn__find_ns(doc->namespaces, SVN_XML_NAMESPACE);
   if (ns == -1)
-    return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                   "The request does not contain the 'svn:' "
                                   "namespace, so it is not going to have an "
                                   "svn:revision element. That element is "
@@ -519,12 +519,12 @@ dav_svn__replay_report(const dav_resourc
 
   if (! SVN_IS_VALID_REVNUM(rev))
     return dav_svn__new_error_svn
-             (resource->pool, HTTP_BAD_REQUEST, 0,
+             (resource->pool, HTTP_BAD_REQUEST, 0, 0,
               "Request was missing the revision argument");
 
   if (! SVN_IS_VALID_REVNUM(low_water_mark))
     return dav_svn__new_error_svn
-             (resource->pool, HTTP_BAD_REQUEST, 0,
+             (resource->pool, HTTP_BAD_REQUEST, 0, 0,
               "Request was missing the low-water-mark argument");
 
   if (! base_dir)

Modified: subversion/branches/ra-git/subversion/mod_dav_svn/reports/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/mod_dav_svn/reports/update.c?rev=1717223&r1=1717222&r2=1717223&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/mod_dav_svn/reports/update.c (original)
+++ subversion/branches/ra-git/subversion/mod_dav_svn/reports/update.c Mon Nov 30 10:24:16 2015
@@ -904,7 +904,7 @@ malformed_element_error(const char *tagn
                                    "' element is malformed; there "
                                    "is a problem with the client.",
                                    SVN_VA_NULL);
-  return dav_svn__new_error_svn(pool, HTTP_BAD_REQUEST, 0, errstr);
+  return dav_svn__new_error_svn(pool, HTTP_BAD_REQUEST, 0, 0, errstr);
 }
 
 
@@ -988,14 +988,14 @@ dav_svn__update_report(const dav_resourc
 
   if ((resource->info->restype != DAV_SVN_RESTYPE_VCC)
       && (resource->info->restype != DAV_SVN_RESTYPE_ME))
-    return dav_svn__new_error_svn(resource->pool, HTTP_CONFLICT, 0,
+    return dav_svn__new_error_svn(resource->pool, HTTP_CONFLICT, 0, 0,
                                   "This report can only be run against "
                                   "a VCC or root-stub URI");
 
   ns = dav_svn__find_ns(doc->namespaces, SVN_XML_NAMESPACE);
   if (ns == -1)
     {
-      return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+      return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                     "The request does not contain the 'svn:' "
                                     "namespace, so it is not going to have an "
                                     "svn:target-revision element. That element "
@@ -1191,7 +1191,7 @@ dav_svn__update_report(const dav_resourc
   if (! src_path)
     {
       return dav_svn__new_error_svn
-        (resource->pool, HTTP_BAD_REQUEST, 0,
+        (resource->pool, HTTP_BAD_REQUEST, 0, 0,
          "The request did not contain the '<src-path>' element.\n"
          "This may indicate that your client is too old");
     }

Modified: subversion/branches/ra-git/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/mod_dav_svn/repos.c?rev=1717223&r1=1717222&r2=1717223&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/mod_dav_svn/repos.c (original)
+++ subversion/branches/ra-git/subversion/mod_dav_svn/repos.c Mon Nov 30 10:24:16 2015
@@ -173,6 +173,9 @@ parse_version_uri(dav_resource_combined
   if (comb->priv.root.rev == SVN_INVALID_REVNUM)
     return TRUE;
 
+  /* We have idempotent resource. */
+  comb->priv.idempotent = TRUE;
+
   return FALSE;
 }
 
@@ -447,6 +450,9 @@ parse_revstub_uri(dav_resource_combined
   /* which baseline (revision tree) to access */
   comb->priv.root.rev = revnum;
 
+  /* all resource parameters are fixed in URI. */
+  comb->priv.idempotent = TRUE;
+
   /* NOTE: comb->priv.repos_path == NULL */
   /* NOTE: comb->priv.created_rev == SVN_INVALID_REVNUM */
 
@@ -813,6 +819,21 @@ prep_regular(dav_resource_combined *comb
                                       pool);
         }
     }
+  else
+    {
+      /* Did we have a query for this REGULAR resource? */
+      if (comb->priv.r->parsed_uri.query)
+        {
+          /* If yes, it's 'idempotent' only if peg revision is specified. */
+          comb->priv.idempotent = comb->priv.pegged;
+        }
+      else
+        {
+          /* Otherwise, we have the specific revision in URI, so the resource
+             is 'idempotent'. */
+          comb->priv.idempotent = TRUE;
+        }
+    }
 
   /* get the root of the tree */
   serr = svn_fs_revision_root(&comb->priv.root.root, repos->fs,
@@ -929,14 +950,14 @@ prep_working(dav_resource_combined *comb
   if (txn_name == NULL)
     {
       if (!comb->priv.root.activity_id)
-        return dav_svn__new_error(comb->res.pool, HTTP_BAD_REQUEST, 0,
+        return dav_svn__new_error(comb->res.pool, HTTP_BAD_REQUEST, 0, 0,
                                   "The request did not specify an activity ID");
 
       txn_name = dav_svn__get_txn(comb->priv.repos,
                                   comb->priv.root.activity_id);
       if (txn_name == NULL)
         {
-          return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0,
+          return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0, 0,
                                     "An unknown activity was specified in the "
                                     "URL. This is generally caused by a "
                                     "problem in the client software.");
@@ -952,7 +973,7 @@ prep_working(dav_resource_combined *comb
       if (serr->apr_err == SVN_ERR_FS_NO_SUCH_TRANSACTION)
         {
           svn_error_clear(serr);
-          return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+          return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
                                     "An activity was specified and found, but "
                                     "the corresponding SVN FS transaction was "
                                     "not found.");
@@ -1012,7 +1033,7 @@ prep_working(dav_resource_combined *comb
         }
       else if (!svn_string_compare(current_author, &request_author))
         {
-          return dav_svn__new_error(pool, HTTP_NOT_IMPLEMENTED, 0,
+          return dav_svn__new_error(pool, HTTP_NOT_IMPLEMENTED, 0, 0,
                                     "Multi-author commits not supported.");
         }
     }
@@ -1067,7 +1088,7 @@ prep_activity(dav_resource_combined *com
   const char *txn_name;
 
   if (!comb->priv.root.activity_id)
-    return dav_svn__new_error(comb->res.pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error(comb->res.pool, HTTP_BAD_REQUEST, 0, 0,
                               "The request did not specify an activity ID");
 
   txn_name = dav_svn__get_txn(comb->priv.repos, comb->priv.root.activity_id);
@@ -1094,7 +1115,7 @@ prep_private(dav_resource_combined *comb
       /* Open the named transaction. */
 
       if (comb->priv.root.txn_name == NULL)
-        return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0,
+        return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0, 0,
                                   "An unknown txn name was specified in the "
                                   "URL.");
 
@@ -1107,7 +1128,7 @@ prep_private(dav_resource_combined *comb
             {
               svn_error_clear(serr);
               comb->res.exists = FALSE;
-              return dav_svn__new_error(pool, HTTP_NOT_FOUND, 0,
+              return dav_svn__new_error(pool, HTTP_NOT_FOUND, 0, 0,
                                         "Named transaction doesn't exist.");
             }
           return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
@@ -1158,7 +1179,7 @@ prep_resource(dav_resource_combined *com
         return (*scan->prep)(comb);
     }
 
-  return dav_svn__new_error(comb->res.pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+  return dav_svn__new_error(comb->res.pool, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
                             "DESIGN FAILURE: unknown resource type");
 }
 
@@ -1256,7 +1277,7 @@ dav_svn_split_uri2(request_rec *r,
     {
       /* ### are SVN_ERR_APMOD codes within the right numeric space? */
       return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR,
-                                SVN_ERR_APMOD_MISSING_PATH_TO_FS,
+                                SVN_ERR_APMOD_MISSING_PATH_TO_FS, 0,
                                 "The server is misconfigured: "
                                 "either an SVNPath or SVNParentPath "
                                 "directive is required to specify the location "
@@ -1339,7 +1360,7 @@ dav_svn_split_uri2(request_rec *r,
         {
           /* ### are SVN_ERR_APMOD codes within the right numeric space? */
           return dav_svn__new_error(pool, HTTP_FORBIDDEN,
-                                    SVN_ERR_APMOD_MALFORMED_URI,
+                                    SVN_ERR_APMOD_MALFORMED_URI, 0,
                                     "The URI does not contain the name "
                                     "of a repository.");
         }
@@ -1387,7 +1408,7 @@ dav_svn_split_uri2(request_rec *r,
           {
             /* relative is just "!svn", which is malformed. */
             return dav_svn__new_error(pool, HTTP_NOT_FOUND,
-                                      SVN_ERR_APMOD_MALFORMED_URI,
+                                      SVN_ERR_APMOD_MALFORMED_URI, 0,
                                       "Nothing follows the svn special_uri.");
           }
         else
@@ -1414,7 +1435,7 @@ dav_svn_split_uri2(request_rec *r,
                         else
                           return dav_svn__new_error(
                                      pool, HTTP_NOT_FOUND,
-                                     SVN_ERR_APMOD_MALFORMED_URI,
+                                     SVN_ERR_APMOD_MALFORMED_URI, 0,
                                      "Missing info after special_uri.");
                       }
                     else if (relative[len3] == '/')
@@ -1438,7 +1459,7 @@ dav_svn_split_uri2(request_rec *r,
                             if (j != (defn->numcomponents - 1))
                               return dav_svn__new_error(
                                          pool, HTTP_NOT_FOUND,
-                                         SVN_ERR_APMOD_MALFORMED_URI,
+                                         SVN_ERR_APMOD_MALFORMED_URI, 0,
                                          "Not enough components after "
                                          "special_uri.");
 
@@ -1458,7 +1479,7 @@ dav_svn_split_uri2(request_rec *r,
                       {
                         return
                           dav_svn__new_error(pool, HTTP_NOT_FOUND,
-                                        SVN_ERR_APMOD_MALFORMED_URI,
+                                        SVN_ERR_APMOD_MALFORMED_URI, 0,
                                         "Unknown data after special_uri.");
                       }
 
@@ -1469,7 +1490,7 @@ dav_svn_split_uri2(request_rec *r,
             if (defn->name == NULL)
               return
                 dav_svn__new_error(pool, HTTP_NOT_FOUND,
-                                   SVN_ERR_APMOD_MALFORMED_URI,
+                                   SVN_ERR_APMOD_MALFORMED_URI, 0,
                                    "Couldn't match subdir after special_uri.");
           }
       }
@@ -1571,7 +1592,7 @@ get_parentpath_resource(request_rec *r,
                             "/", SVN_VA_NULL);
       apr_table_setn(r->headers_out, "Location",
                      ap_construct_url(r->pool, new_uri, r));
-      return dav_svn__new_error(r->pool, HTTP_MOVED_PERMANENTLY, 0,
+      return dav_svn__new_error(r->pool, HTTP_MOVED_PERMANENTLY, 0, 0,
                                 "Requests for a collection must have a "
                                 "trailing slash on the URI.");
     }
@@ -1729,7 +1750,7 @@ negotiate_encoding_prefs(request_rec *r,
      httpd/modules/mappers/mod_negotiation.c).  Thus, we duplicate the
      necessary ones in this file. */
   int i;
-  const apr_array_header_t *encoding_prefs;
+  apr_array_header_t *encoding_prefs;
   encoding_prefs = do_header_line(r->pool,
                                   apr_table_get(r->headers_in,
                                                 "Accept-Encoding"));
@@ -1741,8 +1762,7 @@ negotiate_encoding_prefs(request_rec *r,
     }
 
   *svndiff_version = 0;
-  qsort(encoding_prefs->elts, (size_t) encoding_prefs->nelts,
-        sizeof(accept_rec), sort_encoding_pref);
+  svn_sort__array(encoding_prefs, sort_encoding_pref);
   for (i = 0; i < encoding_prefs->nelts; i++)
     {
       struct accept_rec rec = APR_ARRAY_IDX(encoding_prefs, i,
@@ -1858,6 +1878,22 @@ do_out_of_date_check(dav_resource_combin
                                       "Attempting to modify out-of-date resource.",
                                       r->pool);
         }
+      else if (comb->priv.version_name > created_rev)
+        {
+          svn_revnum_t txn_base_rev;
+
+          txn_base_rev = svn_fs_txn_base_revision(comb->res.info->root.txn);
+          if (comb->priv.version_name > txn_base_rev)
+            {
+              serr = svn_error_createf(SVN_ERR_FS_NO_SUCH_REVISION, NULL,
+                                       "No such revision %ld",
+                                       comb->priv.version_name);
+
+              return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
+                                          "Unknown base revision",
+                                          r->pool);
+            }
+        }
     }
   else if (comb->res.collection)
     {
@@ -1932,7 +1968,7 @@ do_out_of_date_check(dav_resource_combin
                                       r->pool);
         }
 
-      if (node_relation != svn_fs_node_same)
+      if (node_relation != svn_fs_node_unchanged)
         {
           serr = svn_error_createf(SVN_ERR_RA_OUT_OF_DATE, NULL,
                                    "Directory '%s' is out of date",
@@ -1978,7 +2014,7 @@ parse_querystring(request_rec *r, const
         prevstr++;
       peg_rev = SVN_STR_TO_REV(prevstr);
       if (!SVN_IS_VALID_REVNUM(peg_rev))
-        return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0,
+        return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0, 0,
                                   "invalid peg rev in query string");
     }
   else
@@ -1997,7 +2033,7 @@ parse_querystring(request_rec *r, const
         wrevstr++;
       working_rev = SVN_STR_TO_REV(wrevstr);
       if (!SVN_IS_VALID_REVNUM(working_rev))
-        return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0,
+        return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0, 0,
                                   "invalid working rev in query string");
     }
   else
@@ -2011,7 +2047,7 @@ parse_querystring(request_rec *r, const
      Our node-tracing algorithms can't handle that scenario, so we'll
      disallow it here. */
   if (working_rev > peg_rev)
-    return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0, 0,
                               "working rev greater than peg rev.");
 
   /* If WORKING_REV and PEG_REV are equivalent, we want to return the
@@ -2051,9 +2087,9 @@ parse_querystring(request_rec *r, const
         return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
                                     "Couldn't trace history.", pool);
 
-      newpath = apr_hash_get(locations, &working_rev, sizeof(svn_revnum_t));
+      newpath = apr_hash_get(locations, &working_rev, sizeof(working_rev));
       if (! newpath)
-        return dav_svn__new_error(pool, HTTP_NOT_FOUND, 0,
+        return dav_svn__new_error(pool, HTTP_NOT_FOUND, 0, 0,
                                   "path doesn't exist in that revision.");
 
       /* Redirect folks to a canonical, peg-revision-only location.
@@ -2073,7 +2109,7 @@ parse_querystring(request_rec *r, const
       return dav_svn__new_error(r->pool,
                                 prevstr ? HTTP_MOVED_PERMANENTLY
                                         : HTTP_MOVED_TEMPORARILY,
-                                0, "redirecting to canonical location");
+                                0, 0, "redirecting to canonical location");
     }
 
   return NULL;
@@ -2110,6 +2146,16 @@ get_resource(request_rec *r,
   xslt_uri = dav_svn__get_xslt_uri(r);
   fs_parent_path = dav_svn__get_fs_parent_path(r);
 
+  if (r->method_number == M_COPY)
+    {
+      /* Workaround for issue #4531: Avoid a depth-infinity walk on
+         the copy source by overriding the Depth header here.
+         mod_dav defaults to infinite depth if this header is not set
+         which makes copies O(size of source) rather than the desired O(1).
+         ### Should be fixed by an explicit provider API feature in mod_dav. */
+      apr_table_setn(r->headers_in, "Depth", "0");
+    }
+
   /* Special case: detect and build the SVNParentPath as a unique type
      of private resource, iff the SVNListParentPath directive is 'on'. */
   if (dav_svn__is_parentpath_list(r))
@@ -2123,7 +2169,7 @@ get_resource(request_rec *r,
           /* Marshall the error back to the client by generating by
            * way of the dav_svn__error_response_tag trick. */
           err = dav_svn__new_error(r->pool, HTTP_METHOD_NOT_ALLOWED,
-                                   SVN_ERR_APMOD_MALFORMED_URI,
+                                   SVN_ERR_APMOD_MALFORMED_URI, 0,
                                    "The URI does not contain the name "
                                    "of a repository.");
           /* can't use r->allowed since the default handler isn't called */
@@ -2524,7 +2570,7 @@ get_resource(request_rec *r,
                                          SVN_VA_NULL);
       apr_table_setn(r->headers_out, "Location",
                      ap_construct_url(r->pool, new_path, r));
-      return dav_svn__new_error(r->pool, HTTP_MOVED_PERMANENTLY, 0,
+      return dav_svn__new_error(r->pool, HTTP_MOVED_PERMANENTLY, 0, 0,
                                 "Requests for a collection must have a "
                                 "trailing slash on the URI.");
     }
@@ -2549,7 +2595,7 @@ get_resource(request_rec *r,
   /* ### pick something other than HTTP_INTERNAL_SERVER_ERROR */
   /* ### are SVN_ERR_APMOD codes within the right numeric space? */
   return dav_svn__new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR,
-                            SVN_ERR_APMOD_MALFORMED_URI,
+                            SVN_ERR_APMOD_MALFORMED_URI, 0,
                             "The URI indicated a resource within Subversion's "
                             "special resource area, but does not exist. This "
                             "is generally caused by a problem in the client "
@@ -2658,7 +2704,7 @@ get_parent_resource(const dav_resource *
 
   /* If we didn't create parent resource above, complain. */
   if (! *parent_resource)
-    return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+    return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
                               apr_psprintf(resource->pool,
                                            "get_parent_resource was called for "
                                            "%s (type %d)",
@@ -2766,7 +2812,8 @@ open_stream(const dav_resource *resource
     {
       if (resource->type != DAV_RESOURCE_TYPE_WORKING)
         {
-          return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0,
+          return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED,
+                                    0, 0,
                                     "Resource body changes may only be made to "
                                     "working resources (at this time).");
         }
@@ -2775,7 +2822,7 @@ open_stream(const dav_resource *resource
   /* ### TODO:  Can we support range writes someday? */
   if (mode == DAV_MODE_WRITE_SEEKABLE)
     {
-      return dav_svn__new_error(resource->pool, HTTP_NOT_IMPLEMENTED, 0,
+      return dav_svn__new_error(resource->pool, HTTP_NOT_IMPLEMENTED, 0, 0,
                                 "Resource body writes cannot use ranges "
                                 "(at this time).");
     }
@@ -2969,7 +3016,7 @@ seek_stream(dav_stream *stream, apr_off_
 {
   /* ### fill this in */
 
-  return dav_svn__new_error(stream->res->pool, HTTP_NOT_IMPLEMENTED, 0,
+  return dav_svn__new_error(stream->res->pool, HTTP_NOT_IMPLEMENTED, 0, 0,
                             "Resource body read/write cannot use ranges "
                             "(at this time)");
 }
@@ -3009,8 +3056,9 @@ get_last_modified(const dav_resource *re
       return -1;
     }
 
-  if ((serr = svn_fs_revision_prop(&date_time, resource->info->repos->fs,
-                                   created_rev, "svn:date", resource->pool)))
+  if ((serr = svn_fs_revision_prop2(&date_time, resource->info->repos->fs,
+                                    created_rev, "svn:date", TRUE,
+                                    resource->pool, resource->pool)))
     {
       svn_error_clear(serr);
       return -1;
@@ -3069,6 +3117,29 @@ getetag_pathetic(const dav_resource *res
   return dav_svn__getetag(resource, resource->pool);
 }
 
+/* Helper for set_headers(). Returns TRUE if request R to RESOURCE can be
+ * cached. Returns FALSe otherwise. */
+static svn_boolean_t
+is_cacheable(request_rec *r, const dav_resource *resource)
+{
+  /* Non-idempotent resource cannot be cached because actual
+     target could change when youngest revision or transacation
+     will change. */
+  if (!resource->info->idempotent)
+    return FALSE;
+
+  /* Our GET requests on collections include dynamic data (the
+     HEAD revision, the build version of Subversion, etc.).
+     Directory content is also subject of authz filtering.*/
+  if (resource->collection)
+    return FALSE;
+
+  if (resource->type == DAV_RESOURCE_TYPE_REGULAR ||
+      resource->type == DAV_RESOURCE_TYPE_VERSION)
+      return TRUE;
+  else
+      return FALSE;
+}
 
 static dav_error *
 set_headers(request_rec *r, const dav_resource *resource)
@@ -3078,6 +3149,13 @@ set_headers(request_rec *r, const dav_re
   const char *mimetype = NULL;
   apr_time_t last_modified;
 
+  /* As version resources don't change, encourage caching. */
+  if (is_cacheable(r, resource))
+    /* Cache resource for one week (specified in seconds). */
+    apr_table_setn(r->headers_out, "Cache-Control", "max-age=604800");
+  else
+    apr_table_setn(r->headers_out, "Cache-Control", "max-age=0");
+
   if (!resource->exists)
     return NULL;
 
@@ -3094,13 +3172,6 @@ set_headers(request_rec *r, const dav_re
   apr_table_setn(r->headers_out, "ETag",
                  dav_svn__getetag(resource, resource->pool));
 
-  /* As version resources don't change, encourage caching. */
-  if ((resource->type == DAV_RESOURCE_TYPE_REGULAR
-       && resource->versioned && !resource->collection)
-      || resource->type == DAV_RESOURCE_TYPE_VERSION)
-    /* Cache resource for one week (specified in seconds). */
-    apr_table_setn(r->headers_out, "Cache-Control", "max-age=604800");
-
   /* we accept byte-ranges */
   apr_table_setn(r->headers_out, "Accept-Ranges", "bytes");
 
@@ -3275,7 +3346,7 @@ deliver(const dav_resource *resource, ap
           && resource->type != DAV_RESOURCE_TYPE_WORKING
           && resource->info->restype != DAV_SVN_RESTYPE_PARENTPATH_COLLECTION))
     {
-      return dav_svn__new_error(resource->pool, HTTP_CONFLICT, 0,
+      return dav_svn__new_error(resource->pool, HTTP_CONFLICT, 0, 0,
                                 "Cannot GET this type of resource.");
     }
 
@@ -3616,7 +3687,8 @@ deliver(const dav_resource *resource, ap
       bkt = apr_bucket_eos_create(output->c->bucket_alloc);
       APR_BRIGADE_INSERT_TAIL(bb, bkt);
       if ((status = ap_pass_brigade(output, bb)) != APR_SUCCESS)
-        return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+        return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR,
+                                  0, status,
                                   "Could not write EOS to filter.");
 
       return NULL;
@@ -3663,7 +3735,7 @@ deliver(const dav_resource *resource, ap
                                         "is really a file",
                                         resource->pool);
           if (!is_file)
-            return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+            return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                       apr_psprintf(resource->pool,
                                       "the delta base of '%s' does not refer "
                                       "to a file in revision %ld",
@@ -3824,9 +3896,9 @@ deliver(const dav_resource *resource, ap
                                           output->c->bucket_alloc);
         APR_BRIGADE_INSERT_TAIL(bb, bkt);
         if ((status = ap_pass_brigade(output, bb)) != APR_SUCCESS) {
-          /* ### what to do with status; and that HTTP code... */
+          /* ### that HTTP code... */
           return dav_svn__new_error(resource->pool,
-                                    HTTP_INTERNAL_SERVER_ERROR, 0,
+                                    HTTP_INTERNAL_SERVER_ERROR, 0, status,
                                     "Could not write data to filter.");
         }
       }
@@ -3836,9 +3908,9 @@ deliver(const dav_resource *resource, ap
       bkt = apr_bucket_eos_create(output->c->bucket_alloc);
       APR_BRIGADE_INSERT_TAIL(bb, bkt);
       if ((status = ap_pass_brigade(output, bb)) != APR_SUCCESS) {
-        /* ### what to do with status; and that HTTP code... */
+        /* ### that HTTP code... */
         return dav_svn__new_error(resource->pool,
-                                  HTTP_INTERNAL_SERVER_ERROR, 0,
+                                  HTTP_INTERNAL_SERVER_ERROR, 0, status,
                                   "Could not write EOS to filter.");
       }
 
@@ -3856,7 +3928,7 @@ create_collection(dav_resource *resource
   if (resource->type != DAV_RESOURCE_TYPE_WORKING
       && resource->type != DAV_RESOURCE_TYPE_REGULAR)
     {
-      return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0,
+      return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0, 0,
                                 "Collections can only be created within a "
                                 "working or regular collection (at this "
                                 "time).");
@@ -3865,7 +3937,7 @@ create_collection(dav_resource *resource
   /* ...regular resources allowed only if autoversioning is turned on. */
   if (resource->type == DAV_RESOURCE_TYPE_REGULAR
       && ! (resource->info->repos->autoversioning))
-    return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0,
+    return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0, 0,
                               "MKCOL called on regular resource, but "
                               "autoversioning is not active.");
 
@@ -3937,12 +4009,12 @@ copy_resource(const dav_resource *src,
      a new baseline afterwards.  We need to safeguard here that nobody
      is calling COPY with the baseline as a Destination! */
   if (dst->baselined && dst->type == DAV_RESOURCE_TYPE_VERSION)
-    return dav_svn__new_error(src->pool, HTTP_PRECONDITION_FAILED, 0,
+    return dav_svn__new_error(src->pool, HTTP_PRECONDITION_FAILED, 0, 0,
                               "Illegal: COPY Destination is a baseline.");
 
   if (dst->type == DAV_RESOURCE_TYPE_REGULAR
       && !(dst->info->repos->autoversioning))
-    return dav_svn__new_error(dst->pool, HTTP_METHOD_NOT_ALLOWED, 0,
+    return dav_svn__new_error(dst->pool, HTTP_METHOD_NOT_ALLOWED, 0, 0,
                               "COPY called on regular resource, but "
                               "autoversioning is not active.");
 
@@ -3972,7 +4044,7 @@ copy_resource(const dav_resource *src,
 
       if (!serr && (strcmp(src_repos_path, dst_repos_path) != 0))
           return dav_svn__new_error_svn(
-                dst->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+                dst->pool, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
                 "Copy source and destination are in different repositories");
     }
   else
@@ -4018,13 +4090,13 @@ remove_resource(dav_resource *resource,
          || resource->type == DAV_RESOURCE_TYPE_ACTIVITY
          || (resource->type == DAV_RESOURCE_TYPE_PRIVATE
              && resource->info->restype == DAV_SVN_RESTYPE_TXN_COLLECTION)))
-    return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0,
+    return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0, 0,
                               "DELETE called on invalid resource type.");
 
   /* ...and regular resources only if autoversioning is turned on. */
   if (resource->type == DAV_RESOURCE_TYPE_REGULAR
       && ! (resource->info->repos->autoversioning))
-    return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0,
+    return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED, 0, 0,
                               "DELETE called on regular resource, but "
                               "autoversioning is not active.");
 
@@ -4099,6 +4171,22 @@ remove_resource(dav_resource *resource,
                                       "Can't DELETE out-of-date resource",
                                       resource->pool);
         }
+      else if (resource->info->version_name > created_rev)
+        {
+          svn_revnum_t txn_base_rev;
+
+          txn_base_rev = svn_fs_txn_base_revision(resource->info->root.txn);
+          if (resource->info->version_name > txn_base_rev)
+            {
+              serr = svn_error_createf(SVN_ERR_FS_NO_SUCH_REVISION, NULL,
+                                       "No such revision %ld",
+                                       resource->info->version_name);
+
+              return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
+                                          "Unknown base revision",
+                                          resource->pool);
+            }
+        }
     }
 
   /* Before attempting the filesystem delete, we need to push any
@@ -4166,7 +4254,7 @@ move_resource(dav_resource *src,
   if (src->type != DAV_RESOURCE_TYPE_REGULAR
       || dst->type != DAV_RESOURCE_TYPE_REGULAR
       || !(src->info->repos->autoversioning))
-    return dav_svn__new_error(dst->pool, HTTP_METHOD_NOT_ALLOWED, 0,
+    return dav_svn__new_error(dst->pool, HTTP_METHOD_NOT_ALLOWED, 0, 0,
                               "MOVE only allowed on two public URIs, and "
                               "autoversioning must be active.");
 
@@ -4265,7 +4353,7 @@ do_walk(walker_ctx_t *ctx,
   /* ### need to allow more walking in the future */
   if (params->root->type != DAV_RESOURCE_TYPE_REGULAR)
     {
-      return dav_svn__new_error(params->pool, HTTP_METHOD_NOT_ALLOWED, 0,
+      return dav_svn__new_error(params->pool, HTTP_METHOD_NOT_ALLOWED, 0, 0,
                                 "Walking the resource hierarchy can only be "
                                 "done on 'regular' resources [at this time].");
     }
@@ -4588,7 +4676,7 @@ dav_svn__create_version_resource(dav_res
 
   result = parse_version_uri(comb, uri, NULL, 0);
   if (result != 0)
-    return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+    return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
                               "Could not parse version resource uri.");
 
   err = prep_version(comb);
@@ -4616,11 +4704,11 @@ handle_post_request(request_rec *r,
   status = dav_svn__parse_request_skel(&request_skel, r, pool);
 
   if (status != OK)
-    return dav_svn__new_error(pool, status, 0,
+    return dav_svn__new_error(pool, status, 0, 0,
                               "Error parsing skel POST request body.");
 
   if (svn_skel__list_length(request_skel) < 1)
-    return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0,
+    return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0, 0,
                               "Unable to identify skel POST request flavor.");
 
   post_skel = request_skel->children;
@@ -4638,7 +4726,7 @@ handle_post_request(request_rec *r,
                                                  request_skel, output);
     }
 
-  return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0,
+  return dav_svn__new_error(pool, HTTP_BAD_REQUEST, 0, 0,
                             "Unsupported skel POST request flavor.");
 }
 
@@ -4691,7 +4779,7 @@ int dav_svn__method_post(request_rec *r)
     }
   else
     {
-      derr = dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+      derr = dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0, 0,
                                 "Unsupported POST request type.");
     }
 

Modified: subversion/branches/ra-git/subversion/mod_dav_svn/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/mod_dav_svn/status.c?rev=1717223&r1=1717222&r2=1717223&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/mod_dav_svn/status.c (original)
+++ subversion/branches/ra-git/subversion/mod_dav_svn/status.c Mon Nov 30 10:24:16 2015
@@ -29,8 +29,26 @@
 #include "private/svn_cache.h"
 #include "private/svn_fs_private.h"
 
+/* The apache headers define these and they conflict with our definitions. */
+#ifdef PACKAGE_BUGREPORT
+#undef PACKAGE_BUGREPORT
+#endif
+#ifdef PACKAGE_NAME
+#undef PACKAGE_NAME
+#endif
+#ifdef PACKAGE_STRING
+#undef PACKAGE_STRING
+#endif
+#ifdef PACKAGE_TARNAME
+#undef PACKAGE_TARNAME
+#endif
+#ifdef PACKAGE_VERSION
+#undef PACKAGE_VERSION
+#endif
+#include "svn_private_config.h"
+
 #ifndef DEFAULT_TIME_FORMAT
-#define DEFAULT_TIME_FORMAT "%F %H:%M:%S %z"
+#define DEFAULT_TIME_FORMAT "%Y-%m-%d %H:%M:%S %Z"
 #endif
 
 /* A bit like mod_status: add a location:

Modified: subversion/branches/ra-git/subversion/mod_dav_svn/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/mod_dav_svn/util.c?rev=1717223&r1=1717222&r2=1717223&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/mod_dav_svn/util.c (original)
+++ subversion/branches/ra-git/subversion/mod_dav_svn/util.c Mon Nov 30 10:24:16 2015
@@ -40,11 +40,13 @@
 
 #include "dav_svn.h"
 #include "private/svn_fspath.h"
+#include "private/svn_string_private.h"
 
 dav_error *
 dav_svn__new_error(apr_pool_t *pool,
                    int status,
                    int error_id,
+                   apr_status_t aprerr,
                    const char *desc)
 {
   if (error_id == 0)
@@ -58,10 +60,10 @@ dav_svn__new_error(apr_pool_t *pool,
  * > 2.2 below perpetuates this.
  */
 #if AP_MODULE_MAGIC_AT_LEAST(20091119,0)
-  return dav_new_error(pool, status, error_id, 0, desc);
+  return dav_new_error(pool, status, error_id, aprerr, desc);
 #else
 
-  errno = 0; /* For the same reason as in dav_svn__new_error_svn */
+  errno = aprerr; /* For the same reason as in dav_svn__new_error_svn */
 
   return dav_new_error(pool, status, error_id, desc);
 #endif
@@ -71,20 +73,22 @@ dav_error *
 dav_svn__new_error_svn(apr_pool_t *pool,
                        int status,
                        int error_id,
+                       apr_status_t aprerr,
                        const char *desc)
 {
   if (error_id == 0)
     error_id = SVN_ERR_RA_DAV_REQUEST_FAILED;
 
 #if AP_MODULE_MAGIC_AT_LEAST(20091119,0)
-  return dav_new_error_tag(pool, status, error_id, 0,
+  return dav_new_error_tag(pool, status, error_id, aprerr,
                            desc, SVN_DAV_ERROR_NAMESPACE, SVN_DAV_ERROR_TAG);
 #else
-  /* dav_new_error_tag will record errno but Subversion makes no attempt
-     to ensure that it is valid.  We reset it to avoid putting incorrect
-     information into the error log, at the expense of possibly removing
-     valid information. */
-  errno = 0;
+  /* dav_new_error_tag will record errno so we use it to pass aprerr.
+     This overrwites any existing errno value but since Subversion
+     makes no attempt to avoid system calls after a failed system call
+     there is no guarantee that any existing errno represents a
+     relevant error. */
+  errno = aprerr;
 
   return dav_new_error_tag(pool, status, error_id, desc,
                            SVN_DAV_ERROR_NAMESPACE, SVN_DAV_ERROR_TAG);
@@ -100,7 +104,7 @@ build_error_chain(apr_pool_t *pool, svn_
   char buffer[128];
   const char *msg = svn_err_best_message(err, buffer, sizeof(buffer));
 
-  dav_error *derr = dav_svn__new_error_svn(pool, status, err->apr_err,
+  dav_error *derr = dav_svn__new_error_svn(pool, status, err->apr_err, 0,
                                            apr_pstrdup(pool, msg));
 
   if (err->child)
@@ -135,6 +139,7 @@ dav_svn__convert_err(svn_error_t *serr,
   switch (purged_serr->apr_err)
     {
     case SVN_ERR_FS_NOT_FOUND:
+    case SVN_ERR_FS_NO_SUCH_REVISION:
       status = HTTP_NOT_FOUND;
       break;
     case SVN_ERR_UNSUPPORTED_FEATURE:
@@ -216,7 +221,7 @@ dav_svn__get_safe_cr(svn_fs_root_t *root
       return revision;
     }
 
-  if (node_relation == svn_fs_node_same)
+  if (node_relation == svn_fs_node_unchanged)
     return history_rev;  /* the history rev is safe!  the same node
                             exists at the same path in both revisions. */
 
@@ -538,7 +543,7 @@ dav_svn__test_canonical(const char *path
 
   /* Otherwise, generate a generic HTTP_BAD_REQUEST error. */
   return dav_svn__new_error_svn(
-     pool, HTTP_BAD_REQUEST, 0,
+     pool, HTTP_BAD_REQUEST, 0, 0,
      apr_psprintf(pool,
                   "Path '%s' is not canonicalized; "
                   "there is a problem with the client.", path));
@@ -615,7 +620,7 @@ dav_svn__make_base64_output_stream(apr_b
   wb->output = output;
   svn_stream_set_write(stream, brigade_write_fn);
 
-  return svn_base64_encode(stream, pool);
+  return svn_base64_encode2(stream, FALSE, pool);
 }
 
 void
@@ -656,7 +661,7 @@ dav_svn__final_flush_or_error(request_re
     {
       apr_status_t apr_err = ap_fflush(output, bb);
       if (apr_err && (! derr))
-        derr = dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+        derr = dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0, apr_err,
                                   "Error flushing brigade.");
     }
   return derr;
@@ -741,7 +746,7 @@ request_body_to_string(svn_string_t **re
   int seen_eos;
   apr_status_t status;
   apr_off_t total_read = 0;
-  apr_off_t limit_req_body = ap_get_limit_req_body(r);
+  apr_off_t limit_req_body = ap_get_limit_xml_body(r);
   int result = HTTP_BAD_REQUEST;
   const char *content_length_str;
   char *endp;
@@ -819,7 +824,7 @@ request_body_to_string(svn_string_t **re
             {
               ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                             "Request body is larger than the configured "
-                            "limit of %lu", (unsigned long)limit_req_body);
+                            "limit of %" APR_OFF_T_FMT, limit_req_body);
               result = HTTP_REQUEST_ENTITY_TOO_LARGE;
               goto cleanup;
             }
@@ -834,9 +839,7 @@ request_body_to_string(svn_string_t **re
   apr_brigade_destroy(brigade);
 
   /* Make an svn_string_t from our svn_stringbuf_t. */
-  *request_str = svn_string_create_empty(pool);
-  (*request_str)->data = buf->data;
-  (*request_str)->len = buf->len;
+  *request_str = svn_stringbuf__morph_into_string(buf);
   return OK;
 
  cleanup: