Index: subversion/include/svn_io.h =================================================================== --- subversion/include/svn_io.h (revision 1679771) +++ subversion/include/svn_io.h (working copy) @@ -1087,6 +1087,12 @@ svn_boolean_t disown, apr_pool_t *pool); +svn_stream_t * +svn_stream_from_aprfile3(apr_file_t *file, + svn_boolean_t disown, + svn_boolean_t flush_on_close, + apr_pool_t *pool); + /** Similar to svn_stream_from_aprfile2(), except that the file will * always be disowned. * Index: subversion/libsvn_fs_fs/revprops.c =================================================================== --- subversion/libsvn_fs_fs/revprops.c (revision 1679771) +++ subversion/libsvn_fs_fs/revprops.c (working copy) @@ -657,14 +657,16 @@ apr_hash_t *proplist, apr_pool_t *pool) { + apr_file_t *file; svn_stream_t *stream; *final_path = svn_fs_fs__path_revprops(fs, rev, pool); /* ### do we have a directory sitting around already? we really shouldn't ### have to get the dirname here. */ - SVN_ERR(svn_stream_open_unique(&stream, tmp_path, - svn_dirent_dirname(*final_path, pool), - svn_io_file_del_none, pool, pool)); + SVN_ERR(svn_io_open_unique_file3(&file, tmp_path, + svn_dirent_dirname(*final_path, pool), + svn_io_file_del_none, pool, pool)); + stream = svn_stream_from_aprfile3(file, FALSE, TRUE, pool); SVN_ERR(svn_hash_write2(proplist, stream, SVN_HASH_TERMINATOR, pool)); SVN_ERR(svn_stream_close(stream)); @@ -879,7 +881,7 @@ new_filename->data, pool), APR_WRITE | APR_CREATE, APR_OS_DEFAULT, pool)); - *stream = svn_stream_from_aprfile2(file, FALSE, pool); + *stream = svn_stream_from_aprfile3(file, FALSE, TRUE, pool); return SVN_NO_ERROR; } @@ -903,6 +905,7 @@ packed_revprops_t *revprops; apr_int64_t generation = 0; svn_stream_t *stream; + apr_file_t *file; svn_stringbuf_t *serialized; apr_off_t new_total_size; int changed_index; @@ -933,8 +936,10 @@ *final_path = svn_dirent_join(revprops->folder, revprops->filename, pool); - SVN_ERR(svn_stream_open_unique(&stream, tmp_path, revprops->folder, - svn_io_file_del_none, pool, pool)); + SVN_ERR(svn_io_open_unique_file3(&file, tmp_path, revprops->folder, + svn_io_file_del_none, pool, pool)); + stream = svn_stream_from_aprfile3(file, FALSE, TRUE, pool); + SVN_ERR(repack_revprops(fs, revprops, 0, revprops->sizes->nelts, changed_index, serialized, new_total_size, stream, pool)); @@ -1016,8 +1021,9 @@ /* write the new manifest */ *final_path = svn_dirent_join(revprops->folder, PATH_MANIFEST, pool); - SVN_ERR(svn_stream_open_unique(&stream, tmp_path, revprops->folder, - svn_io_file_del_none, pool, pool)); + SVN_ERR(svn_io_open_unique_file3(&file, tmp_path, revprops->folder, + svn_io_file_del_none, pool, pool)); + stream = svn_stream_from_aprfile3(file, FALSE, TRUE, pool); for (i = 0; i < revprops->manifest->nelts; ++i) { Index: subversion/libsvn_subr/stream.c =================================================================== --- subversion/libsvn_subr/stream.c (revision 1679771) +++ subversion/libsvn_subr/stream.c (working copy) @@ -808,6 +808,7 @@ struct baton_apr { apr_file_t *file; apr_pool_t *pool; + svn_boolean_t flush_on_close; }; /* svn_stream_mark_t for streams backed by APR files. */ @@ -1031,10 +1032,10 @@ return SVN_NO_ERROR; } - svn_stream_t * -svn_stream_from_aprfile2(apr_file_t *file, +svn_stream_from_aprfile3(apr_file_t *file, svn_boolean_t disown, + svn_boolean_t flush_on_close, apr_pool_t *pool) { struct baton_apr *baton; @@ -1046,6 +1047,7 @@ baton = apr_palloc(pool, sizeof(*baton)); baton->file = file; baton->pool = pool; + baton->flush_on_close = flush_on_close; stream = svn_stream_create(baton, pool); svn_stream_set_read2(stream, read_handler_apr, read_full_handler_apr); svn_stream_set_write(stream, write_handler_apr); @@ -1056,12 +1058,22 @@ svn_stream__set_is_buffered(stream, is_buffered_handler_apr); stream->file = file; - if (! disown) - svn_stream_set_close(stream, close_handler_apr); + /* ## TODO: How to handle DISOWN = TRUE and FLUSH_ON_CLOSE=TRUE? */ + if (!disown) + svn_stream_set_close(stream, close_handler_apr); return stream; } + +svn_stream_t * +svn_stream_from_aprfile2(apr_file_t *file, + svn_boolean_t disown, + apr_pool_t *pool) +{ + return svn_stream_from_aprfile3(file, disown, FALSE, pool); +} + apr_file_t * svn_stream__aprfile(svn_stream_t *stream) {