You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2014/02/06 09:45:09 UTC

svn commit: r1565116 [2/3] - in /subversion/branches/fsfs-ucsnorm: ./ build/ac-macros/ build/generator/ subversion/bindings/javahl/native/ subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ subversion/bindings/javahl/src/org/apache/s...

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_client/prop_commands.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_client/prop_commands.c Thu Feb  6 08:45:07 2014
@@ -878,25 +878,19 @@ svn_client_propget5(apr_hash_t **props,
       if (SVN_CLIENT__REVKIND_NEEDS_WC(peg_revision->kind)
           || SVN_CLIENT__REVKIND_NEEDS_WC(revision->kind))
         {
-          svn_revnum_t origin_rev;
           const char *repos_relpath;
           const char *repos_root_url;
-          const char *repos_uuid;
           const char *local_abspath;
-          const char *copy_root_abspath;
-          svn_boolean_t is_copy;
 
           SVN_ERR(svn_dirent_get_absolute(&local_abspath, target,
                                           scratch_pool));
 
           if (SVN_CLIENT__REVKIND_NEEDS_WC(peg_revision->kind))
             {
-              SVN_ERR(svn_wc__node_get_origin(&is_copy,
-                                              &origin_rev,
+              SVN_ERR(svn_wc__node_get_origin(NULL, NULL,
                                               &repos_relpath,
                                               &repos_root_url,
-                                              &repos_uuid,
-                                              &copy_root_abspath,
+                                              NULL, NULL, NULL,
                                               ctx->wc_ctx,
                                               local_abspath,
                                               FALSE, /* scan_deleted */
@@ -1281,12 +1275,9 @@ get_remote_props(const char *path_or_url
   if (SVN_CLIENT__REVKIND_NEEDS_WC(peg_revision->kind)
       || SVN_CLIENT__REVKIND_NEEDS_WC(revision->kind))
     {
-      svn_revnum_t origin_rev;
       const char *repos_relpath;
       const char *repos_root_url;
-      const char *repos_uuid;
       const char *local_abspath;
-      const char *copy_root_abspath;
       svn_boolean_t is_copy;
 
       SVN_ERR(svn_dirent_get_absolute(&local_abspath, path_or_url,
@@ -1295,11 +1286,10 @@ get_remote_props(const char *path_or_url
       if (SVN_CLIENT__REVKIND_NEEDS_WC(peg_revision->kind))
         {
           SVN_ERR(svn_wc__node_get_origin(&is_copy,
-                                          &origin_rev,
+                                          NULL,
                                           &repos_relpath,
                                           &repos_root_url,
-                                          &repos_uuid,
-                                          &copy_root_abspath,
+                                          NULL, NULL, NULL,
                                           ctx->wc_ctx,
                                           local_abspath,
                                           FALSE, /* scan_deleted */

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_client/ra.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_client/ra.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_client/ra.c Thu Feb  6 08:45:07 2014
@@ -352,7 +352,6 @@ svn_client__open_ra_session_internal(svn
     cbtable->get_wc_contents = get_wc_contents;
   cbtable->check_tunnel_func = ctx->check_tunnel_func;
   cbtable->open_tunnel_func = ctx->open_tunnel_func;
-  cbtable->close_tunnel_func = ctx->close_tunnel_func;
   cbtable->tunnel_baton = ctx->tunnel_baton;
 
   cb->commit_items = commit_items;
@@ -829,7 +828,7 @@ svn_client__repos_locations(const char *
           svn_boolean_t is_copy;
 
           SVN_ERR(svn_wc__node_get_origin(&is_copy, &peg_revnum, &repos_relpath,
-                                          &repos_root_url, NULL, NULL,
+                                          &repos_root_url, NULL, NULL, NULL,
                                           ctx->wc_ctx, local_abspath_or_url,
                                           FALSE, subpool, subpool));
 
@@ -1091,6 +1090,7 @@ svn_client__ra_provide_base(svn_stream_t
       /* The pristine contents refer to the BASE, or to the pristine of
          a copy/move to this location. Fetch the correct revision.  */
       SVN_ERR(svn_wc__node_get_origin(NULL, revision, NULL, NULL, NULL, NULL,
+                                      NULL,
                                       reb->wc_ctx, local_abspath, FALSE,
                                       scratch_pool, scratch_pool));
     }
@@ -1135,6 +1135,7 @@ svn_client__ra_provide_props(apr_hash_t 
       /* The pristine props refer to the BASE, or to the pristine props of
          a copy/move to this location. Fetch the correct revision.  */
       SVN_ERR(svn_wc__node_get_origin(NULL, revision, NULL, NULL, NULL, NULL,
+                                      NULL,
                                       reb->wc_ctx, local_abspath, FALSE,
                                       scratch_pool, scratch_pool));
     }

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_client/revisions.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_client/revisions.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_client/revisions.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_client/revisions.c Thu Feb  6 08:45:07 2014
@@ -92,6 +92,7 @@ svn_client__get_revision_number(svn_revn
           goto invalid_rev_arg;
 
         err = svn_wc__node_get_origin(NULL, revnum, NULL, NULL, NULL, NULL,
+                                      NULL,
                                       wc_ctx, local_abspath, TRUE,
                                       scratch_pool, scratch_pool);
 

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_client/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_client/util.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_client/util.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_client/util.c Thu Feb  6 08:45:07 2014
@@ -224,7 +224,8 @@ svn_client__wc_node_get_origin(svn_clien
                                   &relpath,
                                   &(*origin_p)->repos_root_url,
                                   &(*origin_p)->repos_uuid,
-                                  NULL, ctx->wc_ctx, wc_abspath,
+                                  NULL, NULL,
+                                  ctx->wc_ctx, wc_abspath,
                                   FALSE /* scan_deleted */,
                                   result_pool, scratch_pool));
   if ((*origin_p)->repos_root_url && relpath)

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_delta/svndiff.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_delta/svndiff.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_delta/svndiff.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_delta/svndiff.c Thu Feb  6 08:45:07 2014
@@ -780,7 +780,7 @@ read_one_byte(unsigned char *byte, svn_s
   char c;
   apr_size_t len = 1;
 
-  SVN_ERR(svn_stream_read(stream, &c, &len));
+  SVN_ERR(svn_stream_read_full(stream, &c, &len));
   if (len == 0)
     return svn_error_create(SVN_ERR_SVNDIFF_UNEXPECTED_END, NULL,
                             _("Unexpected end of svndiff input"));
@@ -861,7 +861,7 @@ svn_txdelta_read_svndiff_window(svn_txde
                              &inslen, &newlen));
   len = inslen + newlen;
   buf = apr_palloc(pool, len);
-  SVN_ERR(svn_stream_read(stream, (char*)buf, &len));
+  SVN_ERR(svn_stream_read_full(stream, (char*)buf, &len));
   if (len < inslen + newlen)
     return svn_error_create(SVN_ERR_SVNDIFF_UNEXPECTED_END, NULL,
                             _("Unexpected end of svndiff input"));

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_delta/text_delta.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_delta/text_delta.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_delta/text_delta.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_delta/text_delta.c Thu Feb  6 08:45:07 2014
@@ -366,14 +366,14 @@ txdelta_next_window(svn_txdelta_window_t
   /* Read the source stream. */
   if (b->more_source)
     {
-      SVN_ERR(svn_stream_read(b->source, b->buf, &source_len));
+      SVN_ERR(svn_stream_read_full(b->source, b->buf, &source_len));
       b->more_source = (source_len == SVN_DELTA_WINDOW_SIZE);
     }
   else
     source_len = 0;
 
   /* Read the target stream. */
-  SVN_ERR(svn_stream_read(b->target, b->buf + source_len, &target_len));
+  SVN_ERR(svn_stream_read_full(b->target, b->buf + source_len, &target_len));
   b->pos += source_len;
 
   if (target_len == 0)
@@ -522,7 +522,7 @@ tpush_write_handler(void *baton, const c
       if (tb->source_len == 0 && !tb->source_done)
         {
           tb->source_len = SVN_DELTA_WINDOW_SIZE;
-          SVN_ERR(svn_stream_read(tb->source, tb->buf, &tb->source_len));
+          SVN_ERR(svn_stream_read_full(tb->source, tb->buf, &tb->source_len));
           if (tb->source_len < SVN_DELTA_WINDOW_SIZE)
             tb->source_done = TRUE;
         }
@@ -819,7 +819,7 @@ apply_window(svn_txdelta_window_t *windo
   if (ab->sbuf_len < window->sview_len)
     {
       len = window->sview_len - ab->sbuf_len;
-      err = svn_stream_read(ab->source, ab->sbuf + ab->sbuf_len, &len);
+      err = svn_stream_read_full(ab->source, ab->sbuf + ab->sbuf_len, &len);
       if (err == SVN_NO_ERROR && len != window->sview_len - ab->sbuf_len)
         err = svn_error_create(SVN_ERR_INCOMPLETE_DATA, NULL,
                                "Delta source ended unexpectedly");
@@ -836,13 +836,7 @@ apply_window(svn_txdelta_window_t *windo
 
   /* Write out the output. */
 
-  /* ### We've also considered just adding two (optionally null)
-     arguments to svn_stream_create(): read_checksum and
-     write_checksum.  Then instead of every caller updating an md5
-     context when it calls svn_stream_write() or svn_stream_read(),
-     streams would do it automatically, and verify the checksum in
-     svn_stream_closed().  But this might be overkill for issue #689;
-     so for now we just update the context here. */
+  /* Just update the context here. */
   if (ab->result_digest)
     apr_md5_update(&(ab->md5_context), ab->tbuf, len);
 
@@ -936,7 +930,7 @@ svn_error_t *svn_txdelta_send_stream(svn
     {
       apr_size_t read_len = SVN__STREAM_CHUNK_SIZE;
 
-      SVN_ERR(svn_stream_read(stream, read_buf, &read_len));
+      SVN_ERR(svn_stream_read_full(stream, read_buf, &read_len));
       if (read_len == 0)
         break;
 

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_base/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_base/lock.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_base/lock.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_base/lock.c Thu Feb  6 08:45:07 2014
@@ -496,12 +496,12 @@ svn_fs_base__get_locks(svn_fs_t *fs,
 
       /* Now read that much into a buffer. */
       skel_buf = apr_palloc(pool, skel_len + 1);
-      SVN_ERR(svn_stream_read(stream, skel_buf, &skel_len));
+      SVN_ERR(svn_stream_read_full(stream, skel_buf, &skel_len));
       skel_buf[skel_len] = '\0';
 
       /* Read the extra newline that follows the skel. */
       len = 1;
-      SVN_ERR(svn_stream_read(stream, &c, &len));
+      SVN_ERR(svn_stream_read_full(stream, &c, &len));
       if (c != '\n')
         return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, NULL);
 

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.c Thu Feb  6 08:45:07 2014
@@ -1690,6 +1690,7 @@ svn_error_t *
 svn_fs_fs__get_contents(svn_stream_t **contents_p,
                         svn_fs_t *fs,
                         representation_t *rep,
+                        svn_boolean_t cache_fulltext,
                         apr_pool_t *pool)
 {
   if (! rep)
@@ -1703,9 +1704,11 @@ svn_fs_fs__get_contents(svn_stream_t **c
       svn_filesize_t len = rep->expanded_size ? rep->expanded_size : rep->size;
       struct rep_read_baton *rb;
 
+      /* Cache lookup, if the fulltext may be cached. */
       fulltext_cache_key.revision = rep->revision;
       fulltext_cache_key.second = rep->item_index;
-      if (ffd->fulltext_cache && SVN_IS_VALID_REVNUM(rep->revision)
+      if (ffd->fulltext_cache && cache_fulltext
+          && SVN_IS_VALID_REVNUM(rep->revision)
           && fulltext_size_is_cachable(ffd, len))
         {
           svn_stringbuf_t *fulltext;
@@ -1720,8 +1723,14 @@ svn_fs_fs__get_contents(svn_stream_t **c
             }
         }
       else
-        fulltext_cache_key.revision = SVN_INVALID_REVNUM;
+        {
+          /* This will also prevent the reconstructed fulltext from being
+             put into the cache. */
+          fulltext_cache_key.revision = SVN_INVALID_REVNUM;
+        }
 
+      /* Create the object chain for reconstruction from deltas or for
+         reading plain text, depending on on-disk representation. */
       SVN_ERR(rep_read_get_baton(&rb, fs, rep, fulltext_cache_key, pool));
 
       *contents_p = svn_stream_create(rb, pool);
@@ -1906,10 +1915,11 @@ svn_fs_fs__get_file_delta_stream(svn_txd
   /* Read both fulltexts and construct a delta. */
   if (source)
     SVN_ERR(svn_fs_fs__get_contents(&source_stream, fs, source->data_rep,
-                                    pool));
+                                    TRUE, pool));
   else
     source_stream = svn_stream_empty(pool);
-  SVN_ERR(svn_fs_fs__get_contents(&target_stream, fs, target->data_rep, pool));
+  SVN_ERR(svn_fs_fs__get_contents(&target_stream, fs, target->data_rep,
+                                  TRUE, pool));
 
   /* Because source and target stream will already verify their content,
    * there is no need to do this once more.  In particular if the stream
@@ -2107,7 +2117,7 @@ get_dir_contents(apr_array_header_t **en
 
       /* The representation is immutable.  Read it normally. */
       SVN_ERR(svn_fs_fs__get_contents(&contents, fs, noderev->data_rep,
-                                      text_pool));
+                                      FALSE, text_pool));
       SVN_ERR(svn_stringbuf_from_stream(&text, contents, len, text_pool));
       SVN_ERR(svn_stream_close(contents));
 
@@ -2306,7 +2316,8 @@ svn_fs_fs__get_proplist(apr_hash_t **pro
         }
 
       proplist = apr_hash_make(pool);
-      SVN_ERR(svn_fs_fs__get_contents(&stream, fs, noderev->prop_rep, pool));
+      SVN_ERR(svn_fs_fs__get_contents(&stream, fs, noderev->prop_rep, FALSE,
+                                      pool));
       SVN_ERR(svn_hash_read2(proplist, stream, SVN_HASH_TERMINATOR, pool));
       SVN_ERR(svn_stream_close(stream));
 

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.h?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.h (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.h Thu Feb  6 08:45:07 2014
@@ -69,12 +69,15 @@ svn_fs_fs__rep_chain_length(int *chain_l
                             apr_pool_t *pool);
 
 /* Set *CONTENTS to be a readable svn_stream_t that receives the text
-   representation REP as seen in filesystem FS.
-   Use POOL for temporary allocations. */
+   representation REP as seen in filesystem FS.  If CACHE_FULLTEXT is
+   not set, bypass fulltext cache lookup for this rep and don't put the
+   reconstructed fulltext into cache.
+   Use POOL for allocations. */
 svn_error_t *
 svn_fs_fs__get_contents(svn_stream_t **contents_p,
                         svn_fs_t *fs,
                         representation_t *rep,
+                        svn_boolean_t cache_fulltext,
                         apr_pool_t *pool);
 
 /* Attempt to fetch the text representation of node-revision NODEREV as

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/dag.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/dag.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/dag.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/dag.c Thu Feb  6 08:45:07 2014
@@ -922,7 +922,7 @@ svn_fs_fs__dag_get_contents(svn_stream_t
 
   /* Get a stream to the contents. */
   SVN_ERR(svn_fs_fs__get_contents(&contents, file->fs,
-                                  noderev->data_rep, pool));
+                                  noderev->data_rep, TRUE, pool));
 
   *contents_p = contents;
 

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/recovery.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/recovery.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/recovery.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/recovery.c Thu Feb  6 08:45:07 2014
@@ -129,7 +129,7 @@ read_handler_recover(void *baton, char *
     bytes_to_read = (apr_size_t)b->remaining;
   b->remaining -= bytes_to_read;
 
-  return svn_stream_read(b->stream, buffer, &bytes_to_read);
+  return svn_stream_read_full(b->stream, buffer, &bytes_to_read);
 }
 
 /* Part of the recovery procedure.  Read the directory noderev at offset

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/transaction.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/transaction.c Thu Feb  6 08:45:07 2014
@@ -2088,7 +2088,7 @@ rep_write_get_baton(struct rep_write_bat
 
   /* Get the base for this delta. */
   SVN_ERR(choose_delta_base(&base_rep, fs, noderev, FALSE, b->pool));
-  SVN_ERR(svn_fs_fs__get_contents(&source, fs, base_rep, b->pool));
+  SVN_ERR(svn_fs_fs__get_contents(&source, fs, base_rep, TRUE, b->pool));
 
   /* Write out the rep header. */
   if (base_rep)
@@ -2679,7 +2679,7 @@ write_container_delta_rep(representation
 
   /* Get the base for this delta. */
   SVN_ERR(choose_delta_base(&base_rep, fs, noderev, is_props, pool));
-  SVN_ERR(svn_fs_fs__get_contents(&source, fs, base_rep, pool));
+  SVN_ERR(svn_fs_fs__get_contents(&source, fs, base_rep, FALSE, pool));
 
   SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, pool));
 

Propchange: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
  Merged /subversion/trunk/subversion/libsvn_fs_x:r1558484-1565115

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/cached_data.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/cached_data.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/cached_data.c Thu Feb  6 08:45:07 2014
@@ -1986,7 +1986,7 @@ get_dir_contents(apr_hash_t *entries,
 
       /* The representation is immutable.  Read it normally. */
       SVN_ERR(svn_fs_x__get_contents(&contents, fs, noderev->data_rep, text_pool));
-      SVN_ERR(svn_stream_read(contents, text->data, &text->len));
+      SVN_ERR(svn_stream_read_full(contents, text->data, &text->len));
       SVN_ERR(svn_stream_close(contents));
 
       /* de-serialize hash */

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/index.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/index.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/index.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/index.c Thu Feb  6 08:45:07 2014
@@ -696,7 +696,7 @@ svn_fs_x__l2p_index_create(svn_fs_t *fs,
   /* start at the beginning of the source file */
   SVN_ERR(svn_io_file_open(&proto_index, proto_file_name,
                            APR_READ | APR_CREATE | APR_BUFFERED,
-                           APR_OS_DEFAULT, pool));
+                           APR_OS_DEFAULT, local_pool));
 
   /* process all entries until we fail due to EOF */
   for (entry = 0; !eof; ++entry)
@@ -755,6 +755,9 @@ svn_fs_x__l2p_index_create(svn_fs_t *fs,
         }
     }
 
+  /* we are now done with the source file */
+  SVN_ERR(svn_io_file_close(proto_index, local_pool));
+
   /* create the target file */
   SVN_ERR(svn_io_file_open(&index_file, file_name, APR_WRITE
                            | APR_CREATE | APR_TRUNCATE | APR_BUFFERED,
@@ -1720,7 +1723,7 @@ svn_fs_x__p2l_index_create(svn_fs_t *fs,
   /* start at the beginning of the source file */
   SVN_ERR(svn_io_file_open(&proto_index, proto_file_name,
                            APR_READ | APR_CREATE | APR_BUFFERED,
-                           APR_OS_DEFAULT, pool));
+                           APR_OS_DEFAULT, local_pool));
 
   /* process all entries until we fail due to EOF */
   while (!eof)
@@ -1818,6 +1821,9 @@ svn_fs_x__p2l_index_create(svn_fs_t *fs,
       svn_pool_clear(iter_pool);
     }
 
+  /* we are now done with the source file */
+  SVN_ERR(svn_io_file_close(proto_index, local_pool));
+
   /* store length of last table */
   APR_ARRAY_PUSH(table_sizes, apr_uint64_t)
       = svn_spillbuf__get_size(buffer) - last_buffer_size;

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/pack.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/pack.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/pack.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/pack.c Thu Feb  6 08:45:07 2014
@@ -1272,7 +1272,7 @@ write_reps_containers(pack_context_t *co
       contents->len = representation.expanded_size;
 
       /* The representation is immutable.  Read it normally. */
-      SVN_ERR(svn_stream_read(stream, contents->data, &contents->len));
+      SVN_ERR(svn_stream_read_full(stream, contents->data, &contents->len));
       SVN_ERR(svn_stream_close(stream));
 
       list_index = svn_fs_x__reps_add(container,

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_serf/update.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_serf/update.c Thu Feb  6 08:45:07 2014
@@ -482,7 +482,7 @@ body_allocate_all(body_create_baton_t *b
         break;
     }
 
-  if (!SERF_BUCKET_READ_ERROR(s) && sz >= 0)
+  if (!SERF_BUCKET_READ_ERROR(s))
     {
       memcpy(next, data, sz);
     }

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/client.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/client.c Thu Feb  6 08:45:07 2014
@@ -451,13 +451,17 @@ static void handle_child_process_error(a
 {
   svn_ra_svn_conn_t *conn;
   apr_file_t *in_file, *out_file;
+  svn_stream_t *in_stream, *out_stream;
   svn_error_t *err;
 
   if (apr_file_open_stdin(&in_file, pool)
       || apr_file_open_stdout(&out_file, pool))
     return;
 
-  conn = svn_ra_svn_create_conn3(NULL, in_file, out_file,
+  in_stream = svn_stream_from_aprfile2(in_file, FALSE, pool);
+  out_stream = svn_stream_from_aprfile2(out_file, FALSE, pool);
+
+  conn = svn_ra_svn_create_conn4(NULL, in_stream, out_stream,
                                  SVN_DELTA_COMPRESSION_LEVEL_DEFAULT, 0,
                                  0, pool);
   err = svn_error_wrap_apr(status, _("Error in child process: %s"), desc);
@@ -528,7 +532,11 @@ static svn_error_t *make_tunnel(const ch
   apr_file_inherit_unset(proc->out);
 
   /* Guard against dotfile output to stdout on the server. */
-  *conn = svn_ra_svn_create_conn3(NULL, proc->out, proc->in,
+  *conn = svn_ra_svn_create_conn4(NULL,
+                                  svn_stream_from_aprfile2(proc->out, FALSE,
+                                                           pool),
+                                  svn_stream_from_aprfile2(proc->in, FALSE,
+                                                           pool),
                                   SVN_DELTA_COMPRESSION_LEVEL_DEFAULT,
                                   0, 0, pool);
   err = svn_ra_svn__skip_leading_garbage(*conn, pool);
@@ -555,9 +563,6 @@ static svn_error_t *parse_url(const char
     return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
                              _("Illegal svn repository URL '%s'"), url);
 
-  if (! uri->port)
-    uri->port = SVN_RA_SVN_PORT;
-
   return SVN_NO_ERROR;
 }
 
@@ -566,24 +571,26 @@ static svn_error_t *parse_url(const char
 struct tunnel_data_t {
   void *tunnel_context;
   void *tunnel_baton;
-  const char *tunnel_name;
-  const char *user;
-  const char *hostname;
-  int port;
   svn_ra_close_tunnel_func_t close_tunnel;
+  svn_stream_t *request;
+  svn_stream_t *response;
 };
 
-/* Pool cleanup function that invokes the close-tunel callback. */
+/* Pool cleanup function that invokes the close-tunnel callback. */
 static apr_status_t close_tunnel_cleanup(void *baton)
 {
   const struct tunnel_data_t *const td = baton;
-  svn_error_t *const err =
-    svn_error_root_cause(td->close_tunnel(td->tunnel_context, td->tunnel_baton,
-                                          td->tunnel_name, td->user,
-                                          td->hostname, td->port));
-  const apr_status_t ret = (err ? err->apr_err : 0);
-  svn_error_clear(err);
-  return ret;
+
+  if (td->close_tunnel)
+    td->close_tunnel(td->tunnel_context, td->tunnel_baton);
+
+  svn_error_clear(svn_stream_close(td->request));
+
+  /* We might have one stream to use for both request and response! */
+  if (td->request != td->response)
+    svn_error_clear(svn_stream_close(td->response));
+
+  return APR_SUCCESS; /* ignored */
 }
 
 /* Open a session to URL, returning it in *SESS_P, allocating it in POOL.
@@ -635,29 +642,23 @@ static svn_error_t *open_session(svn_ra_
         SVN_ERR(make_tunnel(tunnel_argv, &conn, pool));
       else
         {
-          void *tunnel_context;
-          apr_file_t *request;
-          apr_file_t *response;
+          struct tunnel_data_t *const td = apr_palloc(pool, sizeof(*td));
+
+          td->tunnel_baton = callbacks->tunnel_baton;
+          td->close_tunnel = NULL;
+
           SVN_ERR(callbacks->open_tunnel_func(
-                      &request, &response, &tunnel_context,
+                      &td->request, &td->response,
+                      &td->close_tunnel, &td->tunnel_context,
                       callbacks->tunnel_baton, tunnel_name,
                       uri->user, uri->hostname, uri->port,
+                      callbacks->cancel_func, callbacks_baton,
                       pool));
-          if (callbacks->close_tunnel_func)
-            {
-              struct tunnel_data_t *const td = apr_palloc(pool, sizeof(*td));
-              td->tunnel_context = tunnel_context;
-              td->tunnel_baton = callbacks->tunnel_baton;
-              td->tunnel_name = apr_pstrdup(pool, tunnel_name);
-              td->user = apr_pstrdup(pool, uri->user);
-              td->hostname = apr_pstrdup(pool, uri->hostname);
-              td->port = uri->port;
-              td->close_tunnel = callbacks->close_tunnel_func;
-              apr_pool_cleanup_register(pool, td, close_tunnel_cleanup,
-                                        apr_pool_cleanup_null);
-            }
 
-          conn = svn_ra_svn_create_conn3(NULL, response, request,
+          apr_pool_cleanup_register(pool, td, close_tunnel_cleanup,
+                                    apr_pool_cleanup_null);
+
+          conn = svn_ra_svn_create_conn4(NULL, td->response, td->request,
                                          SVN_DELTA_COMPRESSION_LEVEL_DEFAULT,
                                          0, 0, pool);
           SVN_ERR(svn_ra_svn__skip_leading_garbage(conn, pool));
@@ -665,8 +666,10 @@ static svn_error_t *open_session(svn_ra_
     }
   else
     {
-      SVN_ERR(make_connection(uri->hostname, uri->port, &sock, pool));
-      conn = svn_ra_svn_create_conn3(sock, NULL, NULL,
+      SVN_ERR(make_connection(uri->hostname,
+                              uri->port ? uri->port : SVN_RA_SVN_PORT,
+                              &sock, pool));
+      conn = svn_ra_svn_create_conn4(sock, NULL, NULL,
                                      SVN_DELTA_COMPRESSION_LEVEL_DEFAULT,
                                      0, 0, pool);
     }

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/cyrus_auth.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/cyrus_auth.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/cyrus_auth.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/cyrus_auth.c Thu Feb  6 08:45:07 2014
@@ -704,11 +704,12 @@ static void sasl_timeout_cb(void *baton,
   svn_ra_svn__stream_timeout(sasl_baton->stream, interval);
 }
 
-/* Implements ra_svn_pending_fn_t. */
-static svn_boolean_t sasl_pending_cb(void *baton)
+/* Implements svn_stream_data_available_fn_t. */
+static svn_error_t *
+sasl_data_available_cb(void *baton, svn_boolean_t *data_available)
 {
   sasl_baton_t *sasl_baton = baton;
-  return svn_ra_svn__stream_pending(sasl_baton->stream);
+  return svn_ra_svn__stream_data_available(sasl_baton->stream, data_available);
 }
 
 svn_error_t *svn_ra_svn__enable_sasl_encryption(svn_ra_svn_conn_t *conn,
@@ -766,10 +767,19 @@ svn_error_t *svn_ra_svn__enable_sasl_enc
           /* Wrap the existing stream. */
           sasl_baton->stream = conn->stream;
 
-          conn->stream = svn_ra_svn__stream_create(sasl_baton, sasl_read_cb,
-                                                   sasl_write_cb,
-                                                   sasl_timeout_cb,
-                                                   sasl_pending_cb, conn->pool);
+          {
+            svn_stream_t *sasl_in = svn_stream_create(sasl_baton, conn->pool);
+            svn_stream_t *sasl_out = svn_stream_create(sasl_baton, conn->pool);
+
+            svn_stream_set_read2(sasl_in, sasl_read_cb, NULL /* use default */);
+            svn_stream_set_data_available(sasl_in, sasl_data_available_cb);
+            svn_stream_set_write(sasl_out, sasl_write_cb);
+
+            conn->stream = svn_ra_svn__stream_create(sasl_in, sasl_out,
+                                                     sasl_baton,
+                                                     sasl_timeout_cb,
+                                                     conn->pool);
+          }
           /* Yay, we have a security layer! */
           conn->encrypted = TRUE;
         }

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/deprecated.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/deprecated.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/deprecated.c Thu Feb  6 08:45:07 2014
@@ -21,6 +21,10 @@
  * ====================================================================
  */
 
+/* We define this here to remove any further warnings about the usage of
+   deprecated functions in this file. */
+#define SVN_DEPRECATED
+
 #include "svn_ra_svn.h"
 
 #include "private/svn_ra_svn_private.h"
@@ -235,6 +239,27 @@ svn_ra_svn_write_cmd_failure(svn_ra_svn_
 
 /* From marshal.c */
 svn_ra_svn_conn_t *
+svn_ra_svn_create_conn3(apr_socket_t *sock,
+                        apr_file_t *in_file,
+                        apr_file_t *out_file,
+                        int compression_level,
+                        apr_size_t zero_copy_limit,
+                        apr_size_t error_check_interval,
+                        apr_pool_t *pool)
+{
+  svn_stream_t *in_stream = NULL;
+  svn_stream_t *out_stream = NULL;
+
+  if (in_file)
+    in_stream = svn_stream_from_aprfile2(in_file, FALSE, pool);
+  if (out_file)
+    out_stream = svn_stream_from_aprfile2(out_file, FALSE, pool);
+
+  return svn_ra_svn_create_conn4(sock, in_stream, out_stream,
+                                 compression_level, 0, 0, pool);
+}
+
+svn_ra_svn_conn_t *
 svn_ra_svn_create_conn2(apr_socket_t *sock,
                         apr_file_t *in_file,
                         apr_file_t *out_file,

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/editorp.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/editorp.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/editorp.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/editorp.c Thu Feb  6 08:45:07 2014
@@ -126,6 +126,7 @@ static ra_svn_baton_t *ra_svn_make_baton
 static svn_error_t *
 check_for_error_internal(ra_svn_edit_baton_t *eb, apr_pool_t *pool)
 {
+  svn_boolean_t available;
   SVN_ERR_ASSERT(!eb->got_status);
 
   /* reset TX counter */
@@ -135,7 +136,8 @@ check_for_error_internal(ra_svn_edit_bat
   eb->conn->may_check_for_error = eb->conn->error_check_interval == 0;
 
   /* any incoming data? */
-  if (svn_ra_svn__input_waiting(eb->conn, pool))
+  SVN_ERR(svn_ra_svn__data_available(eb->conn, &available));
+  if (available)
     {
       eb->got_status = TRUE;
       SVN_ERR(svn_ra_svn__write_cmd_abort_edit(eb->conn, pool));

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/marshal.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/marshal.c Thu Feb  6 08:45:07 2014
@@ -40,6 +40,7 @@
 #include "svn_pools.h"
 #include "svn_ra_svn.h"
 #include "svn_ctype.h"
+#include "svn_sorts.h"
 #include "svn_time.h"
 
 #include "ra_svn.h"
@@ -80,19 +81,20 @@ get_timeout(svn_ra_svn_conn_t *conn)
 
 /* --- CONNECTION INITIALIZATION --- */
 
-svn_ra_svn_conn_t *svn_ra_svn_create_conn3(apr_socket_t *sock,
-                                           apr_file_t *in_file,
-                                           apr_file_t *out_file,
+svn_ra_svn_conn_t *svn_ra_svn_create_conn4(apr_socket_t *sock,
+                                           svn_stream_t *in_stream,
+                                           svn_stream_t *out_stream,
                                            int compression_level,
                                            apr_size_t zero_copy_limit,
                                            apr_size_t error_check_interval,
-                                           apr_pool_t *pool)
+                                           apr_pool_t *result_pool)
 {
   svn_ra_svn_conn_t *conn;
-  void *mem = apr_palloc(pool, sizeof(*conn) + SVN_RA_SVN__PAGE_SIZE);
+  void *mem = apr_palloc(result_pool, sizeof(*conn) + SVN_RA_SVN__PAGE_SIZE);
   conn = (void*)APR_ALIGN((apr_uintptr_t)mem, SVN_RA_SVN__PAGE_SIZE);
 
-  assert((sock && !in_file && !out_file) || (!sock && in_file && out_file));
+  assert((sock && !in_stream && !out_stream)
+         || (!sock && in_stream && out_stream));
 #ifdef SVN_HAVE_SASL
   conn->sock = sock;
   conn->encrypted = FALSE;
@@ -106,15 +108,15 @@ svn_ra_svn_conn_t *svn_ra_svn_create_con
   conn->may_check_for_error = error_check_interval == 0;
   conn->block_handler = NULL;
   conn->block_baton = NULL;
-  conn->capabilities = apr_hash_make(pool);
+  conn->capabilities = apr_hash_make(result_pool);
   conn->compression_level = compression_level;
   conn->zero_copy_limit = zero_copy_limit;
-  conn->pool = pool;
+  conn->pool = result_pool;
 
   if (sock != NULL)
     {
       apr_sockaddr_t *sa;
-      conn->stream = svn_ra_svn__stream_from_sock(sock, pool);
+      conn->stream = svn_ra_svn__stream_from_sock(sock, result_pool);
       if (!(apr_socket_addr_get(&sa, APR_REMOTE, sock) == APR_SUCCESS
             && apr_sockaddr_ip_get(&conn->remote_ip, sa) == APR_SUCCESS))
         conn->remote_ip = NULL;
@@ -122,7 +124,8 @@ svn_ra_svn_conn_t *svn_ra_svn_create_con
     }
   else
     {
-      conn->stream = svn_ra_svn__stream_from_files(in_file, out_file, pool);
+      conn->stream = svn_ra_svn__stream_from_streams(in_stream, out_stream,
+                                                     result_pool);
       conn->remote_ip = NULL;
     }
 
@@ -195,10 +198,10 @@ svn_ra_svn__set_block_handler(svn_ra_svn
   svn_ra_svn__stream_timeout(conn->stream, get_timeout(conn));
 }
 
-svn_boolean_t svn_ra_svn__input_waiting(svn_ra_svn_conn_t *conn,
-                                        apr_pool_t *pool)
+svn_error_t *svn_ra_svn__data_available(svn_ra_svn_conn_t *conn,
+                                       svn_boolean_t *data_available)
 {
-  return svn_ra_svn__stream_pending(conn->stream);
+  return svn_ra_svn__stream_data_available(conn->stream, data_available);
 }
 
 /* --- WRITE BUFFER MANAGEMENT --- */
@@ -1246,10 +1249,12 @@ svn_ra_svn__has_item(svn_boolean_t *has_
     {
       if (conn->read_ptr == conn->read_end)
         {
+          svn_boolean_t available;
           if (conn->write_pos)
             SVN_ERR(writebuf_flush(conn, pool));
 
-          if (!svn_ra_svn__input_waiting(conn, pool))
+          SVN_ERR(svn_ra_svn__data_available(conn, &available));
+          if (!available)
             break;
 
           SVN_ERR(readbuf_fill(conn, pool));
@@ -2607,7 +2612,7 @@ svn_ra_svn__read_data_log_changed_entry(
   *prop_mods = SVN_RA_SVN_UNSPECIFIED_NUMBER;
 
   /* top-level elements (mandatory) */
-  SVN_ERR(svn_ra_svn__read_check_array_size(items, 3, 4));
+  SVN_ERR(svn_ra_svn__read_check_array_size(items, 3, INT_MAX));
   SVN_ERR(svn_ra_svn__read_string(items, 0, cpath));
   SVN_ERR(svn_ra_svn__read_word(items, 1, action));
 
@@ -2621,12 +2626,10 @@ svn_ra_svn__read_data_log_changed_entry(
     }
 
   /* second sub-structure (optional) */
-  if (items->nelts == 4)
+  if (items->nelts >= 4)
     {
       SVN_ERR(svn_ra_svn__read_list(items, 3, &sub_items));
-      SVN_ERR(svn_ra_svn__read_check_array_size(sub_items, 0, 3));
-
-      switch (sub_items->nelts)
+      switch (MIN(3, sub_items->nelts))
         {
           case 3 : SVN_ERR(svn_ra_svn__read_boolean(sub_items, 2, prop_mods));
           case 2 : SVN_ERR(svn_ra_svn__read_boolean(sub_items, 1, text_mods));

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/ra_svn.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/ra_svn.h?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/ra_svn.h (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/ra_svn.h Thu Feb  6 08:45:07 2014
@@ -147,8 +147,8 @@ void svn_ra_svn__set_block_handler(svn_r
                                    void *baton);
 
 /* Return true if there is input waiting on conn. */
-svn_boolean_t svn_ra_svn__input_waiting(svn_ra_svn_conn_t *conn,
-                                        apr_pool_t *pool);
+svn_error_t *svn_ra_svn__data_available(svn_ra_svn_conn_t *conn,
+                                       svn_boolean_t *data_available);
 
 /* CRAM-MD5 client implementation. */
 svn_error_t *svn_ra_svn__cram_client(svn_ra_svn_conn_t *conn, apr_pool_t *pool,
@@ -171,20 +171,20 @@ svn_error_t *svn_ra_svn__handle_failure_
 svn_ra_svn__stream_t *svn_ra_svn__stream_from_sock(apr_socket_t *sock,
                                                    apr_pool_t *pool);
 
-/* Returns a stream that reads from IN_FILE and writes to OUT_FILE.  */
-svn_ra_svn__stream_t *svn_ra_svn__stream_from_files(apr_file_t *in_file,
-                                                    apr_file_t *out_file,
-                                                    apr_pool_t *pool);
+/* Returns a stream that reads from IN_STREAM and writes to OUT_STREAM,
+   creating a timeout callback for OUT_STREAM if possible  */
+svn_ra_svn__stream_t *svn_ra_svn__stream_from_streams(svn_stream_t *in_stream,
+                                                      svn_stream_t *out_stream,
+                                                      apr_pool_t *pool);
 
 /* Create an svn_ra_svn__stream_t using READ_CB, WRITE_CB, TIMEOUT_CB,
  * PENDING_CB, and BATON.
  */
-svn_ra_svn__stream_t *svn_ra_svn__stream_create(void *baton,
-                                                svn_read_fn_t read_cb,
-                                                svn_write_fn_t write_cb,
+svn_ra_svn__stream_t *svn_ra_svn__stream_create(svn_stream_t *in_stream,
+                                                svn_stream_t *out_stream,
+                                                void *timeout_baton,
                                                 ra_svn_timeout_fn_t timeout_cb,
-                                                ra_svn_pending_fn_t pending_cb,
-                                                apr_pool_t *pool);
+                                                apr_pool_t *result_pool);
 
 /* Write *LEN bytes from DATA to STREAM, returning the number of bytes
  * written in *LEN.
@@ -210,7 +210,9 @@ void svn_ra_svn__stream_timeout(svn_ra_s
                                 apr_interval_time_t interval);
 
 /* Return whether or not there is data pending on STREAM. */
-svn_boolean_t svn_ra_svn__stream_pending(svn_ra_svn__stream_t *stream);
+svn_error_t *
+svn_ra_svn__stream_data_available(svn_ra_svn__stream_t *stream,
+                                  svn_boolean_t *data_available);
 
 /* Respond to an auth request and perform authentication.  Use the Cyrus
  * SASL library for mechanism negotiation and for creating authentication

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/streams.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/streams.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/streams.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_ra_svn/streams.c Thu Feb  6 08:45:07 2014
@@ -33,12 +33,14 @@
 #include "svn_io.h"
 #include "svn_private_config.h"
 
+#include "private/svn_io_private.h"
+
 #include "ra_svn.h"
 
 struct svn_ra_svn__stream_st {
-  svn_stream_t *stream;
-  void *baton;
-  ra_svn_pending_fn_t pending_fn;
+  svn_stream_t *in_stream;
+  svn_stream_t *out_stream;
+  void *timeout_baton;
   ra_svn_timeout_fn_t timeout_fn;
 };
 
@@ -47,11 +49,6 @@ typedef struct sock_baton_t {
   apr_pool_t *pool;
 } sock_baton_t;
 
-typedef struct file_baton_t {
-  apr_file_t *in_file;
-  apr_file_t *out_file;
-  apr_pool_t *pool;
-} file_baton_t;
 
 /* Returns TRUE if PFD has pending data, FALSE otherwise. */
 static svn_boolean_t pending(apr_pollfd_t *pfd, apr_pool_t *pool)
@@ -67,65 +64,34 @@ static svn_boolean_t pending(apr_pollfd_
 
 /* Functions to implement a file backed svn_ra_svn__stream_t. */
 
-/* Implements svn_read_fn_t */
-static svn_error_t *
-file_read_cb(void *baton, char *buffer, apr_size_t *len)
-{
-  file_baton_t *b = baton;
-  apr_status_t status = apr_file_read(b->in_file, buffer, len);
-
-  if (status && !APR_STATUS_IS_EOF(status))
-    return svn_error_wrap_apr(status, _("Can't read from connection"));
-  if (*len == 0)
-    return svn_error_create(SVN_ERR_RA_SVN_CONNECTION_CLOSED, NULL, NULL);
-  return SVN_NO_ERROR;
-}
-
-/* Implements svn_write_fn_t */
-static svn_error_t *
-file_write_cb(void *baton, const char *buffer, apr_size_t *len)
-{
-  file_baton_t *b = baton;
-  apr_status_t status = apr_file_write(b->out_file, buffer, len);
-  if (status)
-    return svn_error_wrap_apr(status, _("Can't write to connection"));
-  return SVN_NO_ERROR;
-}
-
 /* Implements ra_svn_timeout_fn_t */
 static void
 file_timeout_cb(void *baton, apr_interval_time_t interval)
 {
-  file_baton_t *b = baton;
-  apr_file_pipe_timeout_set(b->out_file, interval);
-}
-
-/* Implements ra_svn_pending_fn_t */
-static svn_boolean_t
-file_pending_cb(void *baton)
-{
-  file_baton_t *b = baton;
-  apr_pollfd_t pfd;
-
-  pfd.desc_type = APR_POLL_FILE;
-  pfd.desc.f = b->in_file;
+  apr_file_t *f = baton;
 
-  return pending(&pfd, b->pool);
+  if (f)
+    apr_file_pipe_timeout_set(f, interval);
 }
 
 svn_ra_svn__stream_t *
-svn_ra_svn__stream_from_files(apr_file_t *in_file,
-                              apr_file_t *out_file,
-                              apr_pool_t *pool)
-{
-  file_baton_t *b = apr_palloc(pool, sizeof(*b));
-
-  b->in_file = in_file;
-  b->out_file = out_file;
-  b->pool = pool;
+svn_ra_svn__stream_from_streams(svn_stream_t *in_stream,
+                                svn_stream_t *out_stream,
+                                apr_pool_t *pool)
+{
+  apr_file_t *file;
+
+  /* If out_stream is backed by an apr_file (e.g. an PIPE) we
+     provide a working callback, otherwise the callback ignores
+     the timeout.
+
+     The callback is used to make the write non-blocking on
+     some error scenarios. ### This (legacy) usage
+     breaks the stream promise */
+  file = svn_stream__aprfile(out_stream);
 
-  return svn_ra_svn__stream_create(b, file_read_cb, file_write_cb,
-                                   file_timeout_cb, file_pending_cb,
+  return svn_ra_svn__stream_create(in_stream, out_stream,
+                                   file, file_timeout_cb,
                                    pool);
 }
 
@@ -155,8 +121,6 @@ sock_read_cb(void *baton, char *buffer, 
 
   if (status && !APR_STATUS_IS_EOF(status))
     return svn_error_wrap_apr(status, _("Can't read from connection"));
-  if (*len == 0)
-    return svn_error_create(SVN_ERR_RA_SVN_CONNECTION_CLOSED, NULL, NULL);
   return SVN_NO_ERROR;
 }
 
@@ -179,9 +143,10 @@ sock_timeout_cb(void *baton, apr_interva
   apr_socket_timeout_set(b->sock, interval);
 }
 
-/* Implements ra_svn_pending_fn_t */
-static svn_boolean_t
-sock_pending_cb(void *baton)
+/* Implements svn_stream_data_available_fn_t */
+static svn_error_t *
+sock_pending_cb(void *baton,
+                svn_boolean_t *data_available)
 {
   sock_baton_t *b = baton;
   apr_pollfd_t pfd;
@@ -189,41 +154,45 @@ sock_pending_cb(void *baton)
   pfd.desc_type = APR_POLL_SOCKET;
   pfd.desc.s = b->sock;
 
-  return pending(&pfd, b->pool);
+  *data_available = pending(&pfd, b->pool);
+
+  svn_pool_clear(b->pool);
+
+  return SVN_NO_ERROR;
 }
 
 svn_ra_svn__stream_t *
 svn_ra_svn__stream_from_sock(apr_socket_t *sock,
-                             apr_pool_t *pool)
+                             apr_pool_t *result_pool)
 {
-  sock_baton_t *b = apr_palloc(pool, sizeof(*b));
+  sock_baton_t *b = apr_palloc(result_pool, sizeof(*b));
+  svn_stream_t *sock_stream;
 
   b->sock = sock;
-  b->pool = pool;
+  b->pool = svn_pool_create(result_pool);
 
-  return svn_ra_svn__stream_create(b, sock_read_cb, sock_write_cb,
-                                   sock_timeout_cb, sock_pending_cb,
-                                   pool);
+  sock_stream = svn_stream_create(b, result_pool);
+
+  svn_stream_set_read2(sock_stream, sock_read_cb, NULL /* use default */);
+  svn_stream_set_write(sock_stream, sock_write_cb);
+  svn_stream_set_data_available(sock_stream, sock_pending_cb);
+
+  return svn_ra_svn__stream_create(sock_stream, sock_stream,
+                                   b, sock_timeout_cb, result_pool);
 }
 
 svn_ra_svn__stream_t *
-svn_ra_svn__stream_create(void *baton,
-                          svn_read_fn_t read_cb,
-                          svn_write_fn_t write_cb,
+svn_ra_svn__stream_create(svn_stream_t *in_stream,
+                          svn_stream_t *out_stream,
+                          void *timeout_baton,
                           ra_svn_timeout_fn_t timeout_cb,
-                          ra_svn_pending_fn_t pending_cb,
                           apr_pool_t *pool)
 {
   svn_ra_svn__stream_t *s = apr_palloc(pool, sizeof(*s));
-  s->stream = svn_stream_empty(pool);
-  svn_stream_set_baton(s->stream, baton);
-  if (read_cb)
-    svn_stream_set_read(s->stream, read_cb);
-  if (write_cb)
-    svn_stream_set_write(s->stream, write_cb);
-  s->baton = baton;
+  s->in_stream = in_stream;
+  s->out_stream = out_stream;
+  s->timeout_baton = timeout_baton;
   s->timeout_fn = timeout_cb;
-  s->pending_fn = pending_cb;
   return s;
 }
 
@@ -231,25 +200,33 @@ svn_error_t *
 svn_ra_svn__stream_write(svn_ra_svn__stream_t *stream,
                          const char *data, apr_size_t *len)
 {
-  return svn_stream_write(stream->stream, data, len);
+  return svn_stream_write(stream->out_stream, data, len);
 }
 
 svn_error_t *
 svn_ra_svn__stream_read(svn_ra_svn__stream_t *stream, char *data,
                         apr_size_t *len)
 {
-  return svn_stream_read(stream->stream, data, len);
+  SVN_ERR(svn_stream_read2(stream->in_stream, data, len));
+
+  if (*len == 0)
+    return svn_error_create(SVN_ERR_RA_SVN_CONNECTION_CLOSED, NULL, NULL);
+
+  return SVN_NO_ERROR;
 }
 
 void
 svn_ra_svn__stream_timeout(svn_ra_svn__stream_t *stream,
                            apr_interval_time_t interval)
 {
-  stream->timeout_fn(stream->baton, interval);
+  stream->timeout_fn(stream->timeout_baton, interval);
 }
 
-svn_boolean_t
-svn_ra_svn__stream_pending(svn_ra_svn__stream_t *stream)
+svn_error_t *
+svn_ra_svn__stream_data_available(svn_ra_svn__stream_t *stream,
+                                  svn_boolean_t *data_available)
 {
-  return stream->pending_fn(stream->baton);
+  return svn_error_trace(
+          svn_stream_data_available(stream->in_stream,
+                                    data_available));
 }

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_repos/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_repos/deprecated.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_repos/deprecated.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_repos/deprecated.c Thu Feb  6 08:45:07 2014
@@ -795,6 +795,30 @@ svn_repos_verify_fs(svn_repos_t *repos,
 /*** From load.c ***/
 
 svn_error_t *
+svn_repos_load_fs4(svn_repos_t *repos,
+                   svn_stream_t *dumpstream,
+                   svn_revnum_t start_rev,
+                   svn_revnum_t end_rev,
+                   enum svn_repos_load_uuid uuid_action,
+                   const char *parent_dir,
+                   svn_boolean_t use_pre_commit_hook,
+                   svn_boolean_t use_post_commit_hook,
+                   svn_boolean_t validate_props,
+                   svn_repos_notify_func_t notify_func,
+                   void *notify_baton,
+                   svn_cancel_func_t cancel_func,
+                   void *cancel_baton,
+                   apr_pool_t *pool)
+{
+  return svn_repos_load_fs5(repos, dumpstream, start_rev, end_rev,
+                            uuid_action, parent_dir,
+                            use_post_commit_hook, use_post_commit_hook,
+                            validate_props, FALSE,
+                            notify_func, notify_baton,
+                            cancel_func, cancel_baton, pool);
+}
+
+svn_error_t *
 svn_repos_load_fs3(svn_repos_t *repos,
                    svn_stream_t *dumpstream,
                    enum svn_repos_load_uuid uuid_action,

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_repos/load-fs-vtable.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_repos/load-fs-vtable.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_repos/load-fs-vtable.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_repos/load-fs-vtable.c Thu Feb  6 08:45:07 2014
@@ -55,6 +55,7 @@ struct parse_baton
 
   svn_boolean_t use_history;
   svn_boolean_t validate_props;
+  svn_boolean_t ignore_dates;
   svn_boolean_t use_pre_commit_hook;
   svn_boolean_t use_post_commit_hook;
   enum svn_repos_load_uuid uuid_action;
@@ -696,11 +697,17 @@ set_revision_property(void *baton,
                       const svn_string_t *value)
 {
   struct revision_baton *rb = baton;
+  struct parse_baton *pb = rb->pb;
+  svn_boolean_t is_date = strcmp(name, SVN_PROP_REVISION_DATE) == 0;
 
   /* If we're skipping this revision, we're done here. */
   if (rb->skipped)
     return SVN_NO_ERROR;
 
+  /* If we're ignoring dates, and this is one, we're done here. */
+  if (is_date && pb->ignore_dates)
+    return SVN_NO_ERROR;
+
   if (rb->rev > 0)
     {
       svn_prop_t *prop = &APR_ARRAY_PUSH(rb->revprops, svn_prop_t);
@@ -712,14 +719,13 @@ set_revision_property(void *baton,
 
       /* Remember any datestamp that passes through!  (See comment in
          close_revision() below.) */
-      if (! strcmp(name, SVN_PROP_REVISION_DATE))
+      if (is_date)
         rb->datestamp = svn_string_dup(value, rb->pool);
     }
   else if (rb->rev == 0)
     {
       /* Special case: set revision 0 properties when loading into an
          'empty' filesystem. */
-      struct parse_baton *pb = rb->pb;
       svn_revnum_t youngest_rev;
 
       SVN_ERR(svn_fs_youngest_rev(&youngest_rev, pb->fs, rb->pool));
@@ -927,10 +933,12 @@ close_revision(void *baton)
   if (rb->skipped || (rb->rev <= 0))
     return SVN_NO_ERROR;
 
-  if (!rb->datestamp)
+  /* If the dumpstream doesn't have an 'svn:date' property and we
+     aren't ignoring the dates in the dumpstream altogether, remove
+     any 'svn:date' revision property that was set by FS layer when
+     the TXN was created.  */
+  if (! (pb->ignore_dates || rb->datestamp))
     {
-      /* Remove 'svn:date' revision property that was set by FS layer when TXN
-         created if source dump doesn't have 'svn:date' property. */
       svn_prop_t *prop = &APR_ARRAY_PUSH(rb->revprops, svn_prop_t);
       prop->name = SVN_PROP_REVISION_DATE;
       prop->value = NULL;
@@ -1108,9 +1116,8 @@ svn_repos_get_fs_build_parser4(const svn
 }
 
 
-
 svn_error_t *
-svn_repos_load_fs4(svn_repos_t *repos,
+svn_repos_load_fs5(svn_repos_t *repos,
                    svn_stream_t *dumpstream,
                    svn_revnum_t start_rev,
                    svn_revnum_t end_rev,
@@ -1119,6 +1126,7 @@ svn_repos_load_fs4(svn_repos_t *repos,
                    svn_boolean_t use_pre_commit_hook,
                    svn_boolean_t use_post_commit_hook,
                    svn_boolean_t validate_props,
+                   svn_boolean_t ignore_dates,
                    svn_repos_notify_func_t notify_func,
                    void *notify_baton,
                    svn_cancel_func_t cancel_func,
@@ -1147,6 +1155,7 @@ svn_repos_load_fs4(svn_repos_t *repos,
   pb = parse_baton;
   pb->use_pre_commit_hook = use_pre_commit_hook;
   pb->use_post_commit_hook = use_post_commit_hook;
+  pb->ignore_dates = ignore_dates;
 
   return svn_repos_parse_dumpstream3(dumpstream, parser, parse_baton, FALSE,
                                      cancel_func, cancel_baton, pool);

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_repos/load.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_repos/load.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_repos/load.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_repos/load.c Thu Feb  6 08:45:07 2014
@@ -150,7 +150,7 @@ read_key_or_val(char **pbuf,
   char c;
 
   numread = len;
-  SVN_ERR(svn_stream_read(stream, buf, &numread));
+  SVN_ERR(svn_stream_read_full(stream, buf, &numread));
   *actual_length += numread;
   if (numread != len)
     return svn_error_trace(stream_ran_dry());
@@ -158,7 +158,7 @@ read_key_or_val(char **pbuf,
 
   /* Suck up extra newline after key data */
   numread = 1;
-  SVN_ERR(svn_stream_read(stream, &c, &numread));
+  SVN_ERR(svn_stream_read_full(stream, &c, &numread));
   *actual_length += numread;
   if (numread != 1)
     return svn_error_trace(stream_ran_dry());
@@ -343,7 +343,7 @@ parse_text_block(svn_stream_t *stream,
         rlen = (apr_size_t) content_length;
 
       num_to_read = rlen;
-      SVN_ERR(svn_stream_read(stream, buffer, &rlen));
+      SVN_ERR(svn_stream_read_full(stream, buffer, &rlen));
       content_length -= rlen;
       if (rlen != num_to_read)
         return stream_ran_dry();
@@ -654,7 +654,7 @@ svn_repos_parse_dumpstream3(svn_stream_t
                 rlen = (apr_size_t) remaining;
 
               num_to_read = rlen;
-              SVN_ERR(svn_stream_read(stream, buffer, &rlen));
+              SVN_ERR(svn_stream_read_full(stream, buffer, &rlen));
               remaining -= rlen;
               if (rlen != num_to_read)
                 return stream_ran_dry();

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_repos/reporter.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_repos/reporter.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_repos/reporter.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_repos/reporter.c Thu Feb  6 08:45:07 2014
@@ -1142,7 +1142,7 @@ delta_dirs(report_baton_t *b, svn_revnum
 {
   apr_hash_t *s_entries = NULL, *t_entries;
   apr_hash_index_t *hi;
-  apr_pool_t *subpool;
+  apr_pool_t *subpool = svn_pool_create(pool);
   apr_array_header_t *t_ordered_entries = NULL;
   int i;
 
@@ -1151,23 +1151,26 @@ delta_dirs(report_baton_t *b, svn_revnum
 
      When we support directory locks, we must pass the lock token here. */
   SVN_ERR(delta_proplists(b, s_rev, start_empty ? NULL : s_path, t_path,
-                          NULL, change_dir_prop, dir_baton, pool));
+                          NULL, change_dir_prop, dir_baton, subpool));
+  svn_pool_clear(subpool);
 
   if (requested_depth > svn_depth_empty
       || requested_depth == svn_depth_unknown)
     {
+      apr_pool_t *iterpool;
+
       /* Get the list of entries in each of source and target. */
       if (s_path && !start_empty)
         {
           svn_fs_root_t *s_root;
 
           SVN_ERR(get_source_root(b, &s_root, s_rev));
-          SVN_ERR(svn_fs_dir_entries(&s_entries, s_root, s_path, pool));
+          SVN_ERR(svn_fs_dir_entries(&s_entries, s_root, s_path, subpool));
         }
-      SVN_ERR(svn_fs_dir_entries(&t_entries, b->t_root, t_path, pool));
+      SVN_ERR(svn_fs_dir_entries(&t_entries, b->t_root, t_path, subpool));
 
       /* Iterate over the report information for this directory. */
-      subpool = svn_pool_create(pool);
+      iterpool = svn_pool_create(subpool);
 
       while (1)
         {
@@ -1175,8 +1178,8 @@ delta_dirs(report_baton_t *b, svn_revnum
           const char *name, *s_fullpath, *t_fullpath, *e_fullpath;
           const svn_fs_dirent_t *s_entry, *t_entry;
 
-          svn_pool_clear(subpool);
-          SVN_ERR(fetch_path_info(b, &name, &info, e_path, subpool));
+          svn_pool_clear(iterpool);
+          SVN_ERR(fetch_path_info(b, &name, &info, e_path, iterpool));
           if (!name)
             break;
 
@@ -1193,13 +1196,15 @@ delta_dirs(report_baton_t *b, svn_revnum
                  but don't update the entry yet. */
               if (s_entries)
                 svn_hash_sets(s_entries, name, NULL);
+
+              svn_pool_destroy(info->pool);
               continue;
             }
 
-          e_fullpath = svn_relpath_join(e_path, name, subpool);
-          t_fullpath = svn_fspath__join(t_path, name, subpool);
+          e_fullpath = svn_relpath_join(e_path, name, iterpool);
+          t_fullpath = svn_fspath__join(t_path, name, iterpool);
           t_entry = svn_hash_gets(t_entries, name);
-          s_fullpath = s_path ? svn_fspath__join(s_path, name, subpool) : NULL;
+          s_fullpath = s_path ? svn_fspath__join(s_path, name, iterpool) : NULL;
           s_entry = s_entries ? svn_hash_gets(s_entries, name) : NULL;
 
           /* The only special cases where we don't process the entry are
@@ -1218,7 +1223,7 @@ delta_dirs(report_baton_t *b, svn_revnum
                                  t_entry, dir_baton, e_fullpath, info,
                                  info ? info->depth
                                       : DEPTH_BELOW_HERE(wc_depth),
-                                 DEPTH_BELOW_HERE(requested_depth), subpool));
+                                 DEPTH_BELOW_HERE(requested_depth), iterpool));
 
           /* Don't revisit this name in the target or source entries. */
           svn_hash_sets(t_entries, name, NULL);
@@ -1238,13 +1243,13 @@ delta_dirs(report_baton_t *b, svn_revnum
          target, for graceful handling of case-only renames. */
       if (s_entries)
         {
-          for (hi = apr_hash_first(pool, s_entries);
+          for (hi = apr_hash_first(subpool, s_entries);
                hi;
                hi = apr_hash_next(hi))
             {
               const svn_fs_dirent_t *s_entry = svn__apr_hash_index_val(hi);
 
-              svn_pool_clear(subpool);
+              svn_pool_clear(iterpool);
 
               if (svn_hash_gets(t_entries, s_entry->name) == NULL)
                 {
@@ -1261,24 +1266,24 @@ delta_dirs(report_baton_t *b, svn_revnum
                     continue;
 
                   /* There is no corresponding target entry, so delete. */
-                  e_fullpath = svn_relpath_join(e_path, s_entry->name, subpool);
+                  e_fullpath = svn_relpath_join(e_path, s_entry->name, iterpool);
                   SVN_ERR(svn_repos_deleted_rev(svn_fs_root_fs(b->t_root),
                                                 svn_fspath__join(t_path,
                                                                  s_entry->name,
-                                                                 subpool),
+                                                                 iterpool),
                                                 s_rev, b->t_rev,
-                                                &deleted_rev, subpool));
+                                                &deleted_rev, iterpool));
 
                   SVN_ERR(b->editor->delete_entry(e_fullpath,
                                                   deleted_rev,
-                                                  dir_baton, subpool));
+                                                  dir_baton, iterpool));
                 }
             }
         }
 
       /* Loop over the dirents in the target. */
       SVN_ERR(svn_fs_dir_optimal_order(&t_ordered_entries, b->t_root,
-                                       t_entries, pool));
+                                       t_entries, subpool));
       for (i = 0; i < t_ordered_entries->nelts; ++i)
         {
           const svn_fs_dirent_t *t_entry
@@ -1286,7 +1291,7 @@ delta_dirs(report_baton_t *b, svn_revnum
           const svn_fs_dirent_t *s_entry;
           const char *s_fullpath, *t_fullpath, *e_fullpath;
 
-          svn_pool_clear(subpool);
+          svn_pool_clear(iterpool);
 
           if (is_depth_upgrade(wc_depth, requested_depth, t_entry->kind))
             {
@@ -1311,22 +1316,25 @@ delta_dirs(report_baton_t *b, svn_revnum
               s_entry = s_entries ?
                   svn_hash_gets(s_entries, t_entry->name) : NULL;
               s_fullpath = s_entry ?
-                  svn_fspath__join(s_path, t_entry->name, subpool) : NULL;
+                  svn_fspath__join(s_path, t_entry->name, iterpool) : NULL;
             }
 
           /* Compose the report, editor, and target paths for this entry. */
-          e_fullpath = svn_relpath_join(e_path, t_entry->name, subpool);
-          t_fullpath = svn_fspath__join(t_path, t_entry->name, subpool);
+          e_fullpath = svn_relpath_join(e_path, t_entry->name, iterpool);
+          t_fullpath = svn_fspath__join(t_path, t_entry->name, iterpool);
 
           SVN_ERR(update_entry(b, s_rev, s_fullpath, s_entry, t_fullpath,
                                t_entry, dir_baton, e_fullpath, NULL,
                                DEPTH_BELOW_HERE(wc_depth),
                                DEPTH_BELOW_HERE(requested_depth),
-                               subpool));
+                               iterpool));
         }
 
-      svn_pool_destroy(subpool);
+      /* iterpool is destroyed by destroying its parent (subpool) below */
     }
+
+  svn_pool_destroy(subpool);
+
   return SVN_NO_ERROR;
 }
 

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/cache-membuffer.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/cache-membuffer.c Thu Feb  6 08:45:07 2014
@@ -2452,15 +2452,6 @@ typedef struct svn_membuffer_cache_t
    */
   entry_key_t combined_key;
 
-  /* a pool for temporary allocations during get() and set()
-   */
-  apr_pool_t *pool;
-
-  /* an internal counter that is used to clear the pool from time to time
-   * but not too frequently.
-   */
-  int alloc_counter;
-
   /* cache for the last key used.
    * Will be NULL for caches with short fix-sized keys.
    */
@@ -2694,16 +2685,6 @@ svn_membuffer_cache_set(void *cache_void
   if (key == NULL)
     return SVN_NO_ERROR;
 
-  /* we do some allocations below, so increase the allocation counter
-   * by a slightly larger amount. Free allocated memory every now and then.
-   */
-  cache->alloc_counter += 3;
-  if (cache->alloc_counter > ALLOCATIONS_PER_POOL_CLEAR)
-    {
-      svn_pool_clear(cache->pool);
-      cache->alloc_counter = 0;
-    }
-
   /* construct the full, i.e. globally unique, key by adding
    * this cache instances' prefix
    */
@@ -2718,7 +2699,7 @@ svn_membuffer_cache_set(void *cache_void
                              cache->serializer,
                              cache->priority,
                              DEBUG_CACHE_MEMBUFFER_TAG
-                             cache->pool);
+                             scratch_pool);
 }
 
 /* Implement svn_cache__vtable_t.iter as "not implemented"
@@ -3068,8 +3049,6 @@ svn_cache__create_membuffer_cache(svn_ca
   cache->full_prefix = apr_pstrdup(pool, prefix);
   cache->priority = priority;
   cache->key_len = klen;
-  cache->pool = svn_pool_create(pool);
-  cache->alloc_counter = 0;
 
   SVN_ERR(svn_mutex__init(&cache->mutex, thread_safe, pool));
 

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/config_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/config_file.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/config_file.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/config_file.c Thu Feb  6 08:45:07 2014
@@ -104,8 +104,8 @@ parser_getc(parse_context_t *ctx, int *c
           ctx->buffer_pos = 0;
           ctx->buffer_size = sizeof(ctx->parser_buffer);
 
-          SVN_ERR(svn_stream_read(ctx->stream, ctx->parser_buffer,
-                                  &(ctx->buffer_size)));
+          SVN_ERR(svn_stream_read_full(ctx->stream, ctx->parser_buffer,
+                                       &(ctx->buffer_size)));
 
           if (ctx->buffer_pos < ctx->buffer_size)
             {

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/deprecated.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/deprecated.c Thu Feb  6 08:45:07 2014
@@ -28,6 +28,8 @@
 
 #include <assert.h>
 
+#include <apr_md5.h>
+
 /* We define this here to remove any further warnings about the usage of
    deprecated functions in this file. */
 #define SVN_DEPRECATED
@@ -1066,6 +1068,119 @@ svn_stream_contents_same(svn_boolean_t *
                            pool));
 }
 
+void
+svn_stream_set_read(svn_stream_t *stream,
+                    svn_read_fn_t read_fn)
+{
+  svn_stream_set_read2(stream, NULL /* only full read support */,
+                       read_fn);
+}
+
+svn_error_t *
+svn_stream_read(svn_stream_t *stream,
+                char *buffer,
+                apr_size_t *len)
+{
+  return svn_error_trace(svn_stream_read_full(stream, buffer, len));
+}
+
+struct md5_stream_baton
+{
+  const unsigned char **read_digest;
+  const unsigned char **write_digest;
+  svn_checksum_t *read_checksum;
+  svn_checksum_t *write_checksum;
+  svn_stream_t *proxy;
+  apr_pool_t *pool;
+};
+
+static svn_error_t *
+read_handler_md5(void *baton, char *buffer, apr_size_t *len)
+{
+  struct md5_stream_baton *btn = baton;
+  return svn_error_trace(svn_stream_read2(btn->proxy, buffer, len));
+}
+
+static svn_error_t *
+read_full_handler_md5(void *baton, char *buffer, apr_size_t *len)
+{
+  struct md5_stream_baton *btn = baton;
+  return svn_error_trace(svn_stream_read_full(btn->proxy, buffer, len));
+}
+
+static svn_error_t *
+skip_handler_md5(void *baton, apr_size_t len)
+{
+  struct md5_stream_baton *btn = baton;
+  return svn_error_trace(svn_stream_skip(btn->proxy, len));
+}
+
+static svn_error_t *
+write_handler_md5(void *baton, const char *buffer, apr_size_t *len)
+{
+  struct md5_stream_baton *btn = baton;
+  return svn_error_trace(svn_stream_write(btn->proxy, buffer, len));
+}
+
+static svn_error_t *
+close_handler_md5(void *baton)
+{
+  struct md5_stream_baton *btn = baton;
+
+  SVN_ERR(svn_stream_close(btn->proxy));
+
+  if (btn->read_digest)
+    *btn->read_digest
+      = apr_pmemdup(btn->pool, btn->read_checksum->digest,
+                    APR_MD5_DIGESTSIZE);
+
+  if (btn->write_digest)
+    *btn->write_digest
+      = apr_pmemdup(btn->pool, btn->write_checksum->digest,
+                    APR_MD5_DIGESTSIZE);
+
+  return SVN_NO_ERROR;
+}
+
+
+svn_stream_t *
+svn_stream_checksummed(svn_stream_t *stream,
+                       const unsigned char **read_digest,
+                       const unsigned char **write_digest,
+                       svn_boolean_t read_all,
+                       apr_pool_t *pool)
+{
+  svn_stream_t *s;
+  struct md5_stream_baton *baton;
+
+  if (! read_digest && ! write_digest)
+    return stream;
+
+  baton = apr_palloc(pool, sizeof(*baton));
+  baton->read_digest = read_digest;
+  baton->write_digest = write_digest;
+  baton->pool = pool;
+
+  /* Set BATON->proxy to a stream that will fill in BATON->read_checksum
+   * and BATON->write_checksum (if we want them) when it is closed. */
+  baton->proxy
+    = svn_stream_checksummed2(stream,
+                              read_digest ? &baton->read_checksum : NULL,
+                              write_digest ? &baton->write_checksum : NULL,
+                              svn_checksum_md5,
+                              read_all, pool);
+
+  /* Create a stream that will forward its read/write/close operations to
+   * BATON->proxy and will fill in *READ_DIGEST and *WRITE_DIGEST (if we
+   * want them) after it closes BATON->proxy. */
+  s = svn_stream_create(baton, pool);
+  svn_stream_set_read2(s, read_handler_md5, read_full_handler_md5);
+  svn_stream_set_skip(s, skip_handler_md5);
+  svn_stream_set_write(s, write_handler_md5);
+  svn_stream_set_close(s, close_handler_md5);
+  return s;
+}
+
 /*** From path.c ***/
 
 const char *

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/hash.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/hash.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/hash.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/hash.c Thu Feb  6 08:45:07 2014
@@ -136,12 +136,12 @@ svn_hash__read_entry(svn_hash__entry_t *
 
       /* Now read that much into a buffer. */
       entry->key = apr_palloc(pool, entry->keylen + 1);
-      SVN_ERR(svn_stream_read(stream, entry->key, &entry->keylen));
+      SVN_ERR(svn_stream_read_full(stream, entry->key, &entry->keylen));
       entry->key[entry->keylen] = '\0';
 
       /* Suck up extra newline after key data */
       len = 1;
-      SVN_ERR(svn_stream_read(stream, &c, &len));
+      SVN_ERR(svn_stream_read_full(stream, &c, &len));
       if (c != '\n')
         return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
                                 _("Serialized hash malformed"));
@@ -160,12 +160,12 @@ svn_hash__read_entry(svn_hash__entry_t *
           entry->vallen = (apr_size_t)ui64;
 
           entry->val = apr_palloc(pool, entry->vallen + 1);
-          SVN_ERR(svn_stream_read(stream, entry->val, &entry->vallen));
+          SVN_ERR(svn_stream_read_full(stream, entry->val, &entry->vallen));
           entry->val[entry->vallen] = '\0';
 
           /* Suck up extra newline after val data */
           len = 1;
-          SVN_ERR(svn_stream_read(stream, &c, &len));
+          SVN_ERR(svn_stream_read_full(stream, &c, &len));
           if (c != '\n')
             return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
                                     _("Serialized hash malformed"));
@@ -187,12 +187,12 @@ svn_hash__read_entry(svn_hash__entry_t *
 
       /* Now read that much into a buffer. */
       entry->key = apr_palloc(pool, entry->keylen + 1);
-      SVN_ERR(svn_stream_read(stream, entry->key, &entry->keylen));
+      SVN_ERR(svn_stream_read_full(stream, entry->key, &entry->keylen));
       entry->key[entry->keylen] = '\0';
 
       /* Suck up extra newline after key data */
       len = 1;
-      SVN_ERR(svn_stream_read(stream, &c, &len));
+      SVN_ERR(svn_stream_read_full(stream, &c, &len));
       if (c != '\n')
         return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
                                 _("Serialized hash malformed"));

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/nls.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/nls.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/nls.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/nls.c Thu Feb  6 08:45:07 2014
@@ -62,10 +62,10 @@ svn_nls_init(void)
       scratch_pool = svn_pool_create(NULL);
       /* get exe name - our locale info will be in '../share/locale' */
       GetModuleFileNameW(NULL, ucs2_path,
-          sizeof(ucs2_path) / sizeof(ucs2_path[0]))
+          sizeof(ucs2_path) / sizeof(ucs2_path[0]));
       if (apr_get_os_error())
         {
-          err = svn_error_wrap_apr(apr_get_os_error()
+          err = svn_error_wrap_apr(apr_get_os_error(),
                                    _("Can't get module file name"));
         }
 

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/packed_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/packed_data.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/packed_data.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/packed_data.c Thu Feb  6 08:45:07 2014
@@ -706,7 +706,7 @@ read_stream_uint(svn_stream_t *stream, a
   do
     {
       apr_size_t len = 1;
-      SVN_ERR(svn_stream_read(stream, (char *)&c, &len));
+      SVN_ERR(svn_stream_read_full(stream, (char *)&c, &len));
       if (len != 1)
         return svn_error_create(SVN_ERR_CORRUPT_PACKED_DATA, NULL,
                                 _("Unexpected end of stream"));
@@ -949,7 +949,7 @@ read_stream_data(svn_stream_t *stream,
 
   svn_stringbuf_ensure(compressed, compressed_len);
   compressed->len = compressed_len;
-  SVN_ERR(svn_stream_read(stream, compressed->data, &compressed->len));
+  SVN_ERR(svn_stream_read_full(stream, compressed->data, &compressed->len));
   compressed->data[compressed_len] = '\0';
 
   SVN_ERR(svn__decompress(compressed, uncompressed, uncompressed_len));
@@ -1033,7 +1033,7 @@ svn_packed__data_read(svn_packed__data_r
     = svn_stringbuf_create_ensure((apr_size_t)tree_struct_size, scratch_pool);
   tree_struct->len = (apr_size_t)tree_struct_size;
   
-  SVN_ERR(svn_stream_read(stream, tree_struct->data, &tree_struct->len));
+  SVN_ERR(svn_stream_read_full(stream, tree_struct->data, &tree_struct->len));
   tree_struct->data[tree_struct->len] = '\0';
 
   /* reconstruct tree structure */

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/sqlite.c?rev=1565116&r1=1565115&r2=1565116&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_subr/sqlite.c Thu Feb  6 08:45:07 2014
@@ -37,6 +37,10 @@
 #include "private/svn_atomic.h"
 #include "private/svn_skel.h"
 #include "private/svn_token.h"
+#ifdef WIN32
+#include "private/svn_io_private.h"
+#include "private/svn_utf_private.h"
+#endif
 
 #ifdef SVN_UNICODE_NORMALIZATION_FIXES
 #include "private/svn_utf_private.h"
@@ -854,11 +858,35 @@ internal_open(sqlite3 **db3, const char 
        occurs (except for out-of-memory); thus, we can safely use it to
        extract an error message and construct an svn_error_t. */
     {
+      const char *vFs = NULL;
+      int err_code;
       /* We'd like to use SQLITE_ERR here, but we can't since it would
          just return an error and leave the database open.  So, we need to
          do this manually. */
+
+#if defined(WIN32) && SQLITE_VERSION_AT_LEAST(3, 8, 1)
+      if (strlen(path) > 248)
+        {
+          WCHAR *win_path;
+          vFs = "win32-longpath"; /* Enable long paths in sqlite */
+
+          /* Long paths must be absolute */
+          if (!svn_dirent_is_absolute(path))
+            SVN_ERR(svn_dirent_get_absolute(&path, path, scratch_pool));
+
+          /* Convert the path to a properly canonicalized \\?\C:\long\path */
+          SVN_ERR(svn_io__utf8_to_unicode_longpath(&win_path, path,
+                                                   scratch_pool));
+
+          /* And convert it back to UTF-8 because there is no
+              sqlite3_open16_v2() yet */
+          SVN_ERR(svn_utf__win32_utf16_to_utf8(&path, win_path, NULL,
+                                               scratch_pool));
+        }
+#endif
+
       /* ### SQLITE_CANTOPEN */
-      int err_code = sqlite3_open_v2(path, db3, flags, NULL);
+      err_code = sqlite3_open_v2(path, db3, flags, vFs);
       if (err_code != SQLITE_OK)
         {
           /* Save the error message before closing the SQLite handle. */