Author: hwright
Date: Wed Jan 18 15:40:49 2012
New Revision: 1232939
URL: http://svn.apache.org/viewvc?rev=1232939&view=rev
Log:
On the ev2-export branch:
Avoid creating a temporary file when translating during an export.
* subversion/libsvn_client/export.c
(add_file): Don't create a temporary file for translation, just wrap it with
a translating stream.
Modified:
subversion/branches/ev2-export/subversion/libsvn_client/export.c
Modified: subversion/branches/ev2-export/subversion/libsvn_client/export.c
URL:
http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/export.c?rev=1232939&r1=1232938&r2=1232939&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/export.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/export.c Wed Jan 18
15:40:49 2012
@@ -730,16 +730,6 @@ add_file(void *baton,
const char *author = NULL;
apr_time_t date = 0;
- /* Create a temporary file in the same directory as the file. We're going
- to rename the thing into place when we're done. */
- SVN_ERR(svn_stream_open_unique(&tmp_stream, &tmppath,
- svn_dirent_dirname(full_path, scratch_pool),
- svn_io_file_del_none,
- scratch_pool, scratch_pool));
-
- SVN_ERR(svn_stream_copy3(contents, tmp_stream,
- eb->cancel_func, eb->cancel_baton, scratch_pool));
-
/* Look at any properties for additional information. */
if ( (val = apr_hash_get(props, SVN_PROP_EOL_STYLE, APR_HASH_KEY_STRING)) )
eol_style_val = val;
@@ -767,12 +757,8 @@ add_file(void *baton,
if ( (val = apr_hash_get(props, SVN_PROP_SPECIAL, APR_HASH_KEY_STRING)) )
special = TRUE;
- /* Move the file into place and tweak it as dictated by the props. */
- if ((! eol_style_val) && (! keywords_val) && (! special))
- {
- SVN_ERR(svn_io_file_rename(tmppath, full_path, scratch_pool));
- }
- else
+ /* Possibly wrap the stream to be translated, as dictated by the props. */
+ if (eol_style_val || keywords_val || special)
{
svn_subst_eol_style_t style;
const char *eol = NULL;
@@ -791,16 +777,29 @@ add_file(void *baton,
revision, full_url, date,
author, scratch_pool));
- SVN_ERR(svn_subst_copy_and_translate4(tmppath, full_path,
- eol, repair, final_kw,
- TRUE, /* expand */
- special,
- eb->cancel_func, eb->cancel_baton,
- scratch_pool));
-
- SVN_ERR(svn_io_remove_file2(tmppath, FALSE, scratch_pool));
+ /* ### Note: We used to use svn_subst_copy_and_translate() here, which
+ handles the "special" property correctly. I'm unsure what the
+ right thing to do is now that we have a wrapped stream. Maybe
+ we don't have a worry about it since Ev2 provides a add_symlink()
+ handler? */
+ contents = svn_subst_stream_translated(contents, eol, repair, final_kw,
+ TRUE, /* expand */
+ scratch_pool);
}
+ /* Create a temporary file in the same directory as the file. We're going
+ to rename the thing into place when we're done. */
+ SVN_ERR(svn_stream_open_unique(&tmp_stream, &tmppath,
+ svn_dirent_dirname(full_path, scratch_pool),
+ svn_io_file_del_none,
+ scratch_pool, scratch_pool));
+
+ SVN_ERR(svn_stream_copy3(contents, tmp_stream,
+ eb->cancel_func, eb->cancel_baton, scratch_pool));
+
+ /* Move the file into place. */
+ SVN_ERR(svn_io_file_rename(tmppath, full_path, scratch_pool));
+
if (executable_val)
SVN_ERR(svn_io_set_file_executable(full_path, TRUE, FALSE, scratch_pool));