You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2012/11/19 22:10:26 UTC

svn commit: r1411413 - /subversion/branches/tree-read-api/subversion/libsvn_ra/ra_trees.c

Author: julianfoad
Date: Mon Nov 19 21:10:25 2012
New Revision: 1411413

URL: http://svn.apache.org/viewvc?rev=1411413&view=rev
Log:
On the 'tree-read-api' branch:

* subversion/libsvn_ra/ra_trees.c
  (ra_treen_read_file): Support the case where no stream is wanted.

Modified:
    subversion/branches/tree-read-api/subversion/libsvn_ra/ra_trees.c

Modified: subversion/branches/tree-read-api/subversion/libsvn_ra/ra_trees.c
URL: http://svn.apache.org/viewvc/subversion/branches/tree-read-api/subversion/libsvn_ra/ra_trees.c?rev=1411413&r1=1411412&r2=1411413&view=diff
==============================================================================
--- subversion/branches/tree-read-api/subversion/libsvn_ra/ra_trees.c (original)
+++ subversion/branches/tree-read-api/subversion/libsvn_ra/ra_trees.c Mon Nov 19 21:10:25 2012
@@ -117,16 +117,26 @@ ra_treen_read_file(svn_tree_node_t *node
                    apr_pool_t *scratch_pool)
 {
   ra_tree_node_baton_t *nb = node->priv;
-  svn_stream_t *holding_stream;
 
-  SVN_ERR(svn_stream_open_unique(&holding_stream, NULL, NULL,
-                                 svn_io_file_del_on_close,
-                                 result_pool, scratch_pool));
-  SVN_ERR(ra_unauthz_err(svn_ra_get_file(nb->tb->ra_session, nb->relpath,
-                                         nb->tb->revnum, holding_stream,
-                                         NULL, props, result_pool)));
-  SVN_ERR(svn_stream_reset(holding_stream));
-  *stream = holding_stream;
+  if (stream)
+    {
+      /* Spool the content into a temp file, rewind, and return that stream
+       * for the caller to read. */
+      SVN_ERR(svn_stream_open_unique(stream, NULL, NULL,
+                                     svn_io_file_del_on_close,
+                                     result_pool, scratch_pool));
+      SVN_ERR(ra_unauthz_err(svn_ra_get_file(nb->tb->ra_session, nb->relpath,
+                                             nb->tb->revnum, *stream,
+                                             NULL, props, result_pool)));
+      SVN_ERR(svn_stream_reset(*stream));
+    }
+  else
+    {
+      /* Just get the properties. */
+      SVN_ERR(ra_unauthz_err(svn_ra_get_file(nb->tb->ra_session, nb->relpath,
+                                             nb->tb->revnum, NULL,
+                                             NULL, props, result_pool)));
+    }
   return SVN_NO_ERROR;
 }