Index: subversion/include/svn_wc.h =================================================================== --- subversion/include/svn_wc.h (revision 6715) +++ subversion/include/svn_wc.h (working copy) @@ -1547,6 +1547,16 @@ void *helper_baton, apr_pool_t *pool); +/* + * A Post Handler for add_repos_file(). Should be called after svn_wc_add(). + * Accepts a subset of the same parameters. + * */ +svn_error_t * +svn_wc_add_repos_file_post (const char *dst_path, + svn_wc_adm_access_t *adm_access, + apr_pool_t *pool); + + /* A word about the implementation of working copy property storage: * Index: subversion/libsvn_wc/update_editor.c =================================================================== --- subversion/libsvn_wc/update_editor.c (revision 6715) +++ subversion/libsvn_wc/update_editor.c (working copy) @@ -2480,6 +2480,66 @@ SVN_WC__LOG_ATTR_NAME, rel_real_text_base, NULL); + /* Now copy the text-base to the main file while not applying the end-of-line + * and keywords policies. Later the post function will copy and + * translate it. */ + svn_xml_make_open_tag (&log_accum, pool, + svn_xml_self_closing, + SVN_WC__LOG_CP, + SVN_WC__LOG_ATTR_NAME, rel_real_text_base, + SVN_WC__LOG_ATTR_DEST, base_name, + NULL); + + /* Write our accumulation of log entries into a log file */ + status = apr_file_write_full (log_fp, log_accum->data, + log_accum->len, NULL); + if (status) + { + apr_file_close (log_fp); + return svn_error_createf (status, NULL, + "error writing log for '%s'.", + dst_path); + } + + /* The log is ready to run. Close it and run it! */ + SVN_ERR (svn_wc__close_adm_file (log_fp, parent_dir, SVN_WC__ADM_LOG, + TRUE, /* sync */ pool)); + SVN_ERR (svn_wc__run_log (adm_access, NULL, pool)); + + return SVN_NO_ERROR; +} + +svn_error_t * +svn_wc_add_repos_file_post (const char *dst_path, + svn_wc_adm_access_t *adm_access, + apr_pool_t *pool) +{ + const char *parent_dir; + const char *base_name; + apr_file_t *log_fp = NULL; + svn_stringbuf_t *log_accum; + const char *rel_real_text_base; + apr_status_t status; + + /* Split FILE_PATH. */ + svn_path_split (dst_path, &parent_dir, &base_name, pool); + + /* + * Get the relative (to the log directory) path of the real + * text base. + * */ + rel_real_text_base = svn_wc__text_base_path(base_name, FALSE, pool); + + /* Open a log file. This is safe because the adm area is locked + right now. */ + SVN_ERR (svn_wc__open_adm_file (&log_fp, + parent_dir, + SVN_WC__ADM_LOG, + (APR_WRITE | APR_CREATE), /* not excl */ + pool)); + + log_accum = svn_stringbuf_create ("", pool); + /* Now copy the text-base to the main file while applying the end-of-line * and keywords policies */ svn_xml_make_open_tag (&log_accum, pool, @@ -2488,9 +2548,9 @@ SVN_WC__LOG_ATTR_NAME, rel_real_text_base, SVN_WC__LOG_ATTR_DEST, base_name, NULL); - + /* Write our accumulation of log entries into a log file */ - status = apr_file_write_full (log_fp, log_accum->data, + status = apr_file_write_full (log_fp, log_accum->data, log_accum->len, NULL); if (status) { Index: subversion/libsvn_client/copy.c =================================================================== --- subversion/libsvn_client/copy.c (revision 6715) +++ subversion/libsvn_client/copy.c (working copy) @@ -941,6 +941,13 @@ SVN_ERR (svn_wc_add (dst_path, adm_access, src_url, src_revnum, ctx->cancel_func, ctx->cancel_baton, ctx->notify_func, ctx->notify_baton, pool)); + + if (src_kind == svn_node_file) + { + SVN_ERR (svn_wc_add_repos_file_post (dst_path, + adm_access, + pool)); + } } else { Index: subversion/tests/clients/cmdline/copy_tests.py =================================================================== --- subversion/tests/clients/cmdline/copy_tests.py (revision 6715) +++ subversion/tests/clients/cmdline/copy_tests.py (working copy) @@ -1145,8 +1145,48 @@ # Run diff. svntest.actions.run_and_verify_svn(None, None, [], 'diff', wc_dir) + +def repos_to_wc_copy_eol_keywords(sbox): + "check processing of properties of repos->WC copy" + + sbox.build() + wc_dir = sbox.wc_dir + iota_repos_path = svntest.main.current_repo_url + '/iota' + iota_wc_path = os.path.join(wc_dir, 'iota'); + target_wc_path = os.path.join(wc_dir, 'new_file'); + # Modify iota to make it checkworthy + f = open(iota_wc_path, "ab") + f.write("\nHello\nSubversion\n$LastChangedRevision$\n"); + f.close(); + + svntest.actions.run_and_verify_svn(None, None, [], 'propset', 'svn:eol-style', + 'CRLF', iota_wc_path) + + svntest.actions.run_and_verify_svn(None, None, [], 'propset', 'svn:keywords', + 'Rev', iota_wc_path) + + svntest.actions.run_and_verify_svn(None, None, [], 'commit', '-m', 'Hoola', + wc_dir); + + # Copy a file from the repository to the working copy. + svntest.actions.run_and_verify_svn(None, None, [], 'cp', + iota_repos_path, target_wc_path) + + # Read the entire target_wc_path into memory. + + f = open(target_wc_path, "rb"); + contents = f.read(); + f.close(); + + if (re.compile('[^\\r]\\n').search(contents, 0)): + raise svntest.Failure + + if (not(re.compile('\$LastChangedRevision:\\s*-\\d+\\s*\$').search(contents, 0))): + raise svntest.Failure + + ######################################################################## # Run the tests @@ -1171,6 +1211,7 @@ wc_copy_parent_into_child, resurrect_deleted_file, diff_repos_to_wc_copy, + repos_to_wc_copy_eol_keywords, ] if __name__ == '__main__':