Index: subversion/libsvn_wc/adm_ops.c =================================================================== --- subversion/libsvn_wc/adm_ops.c (revision 6604) +++ subversion/libsvn_wc/adm_ops.c (working copy) @@ -1015,6 +1015,27 @@ parent_access, pool)); } } + else + { + /* + * If it is a copied file, create a text base for it that is + * identical to the file contents. + * */ + const char * text_base_path; + apr_status_t status; + svn_node_kind_t existing_text_base_kind; + + text_base_path = svn_wc__text_base_path(path, FALSE, pool); + + /* First - check if it already exists - if so don't copy it */ + SVN_ERR (svn_io_check_path (text_base_path, + &existing_text_base_kind, pool)); + + if (existing_text_base_kind == svn_node_none) + { + SVN_ERR (svn_io_copy_file (path, text_base_path, FALSE, pool)); + } + } } else /* scheduling a directory for addition */ { Index: subversion/tests/clients/cmdline/copy_tests.py =================================================================== --- subversion/tests/clients/cmdline/copy_tests.py (revision 6613) +++ subversion/tests/clients/cmdline/copy_tests.py (working copy) @@ -1105,8 +1105,26 @@ }) svntest.actions.run_and_verify_status (wc_dir, expected_status) +#------------------------------------------------------------- +# Issue #1297: +# svn diff failed after a repository to WC copy of a single file +# This test checks just that. +def repos_to_wc_copy_a_file_and_diff(sbox): + "Repos->WC Copy a file and Diff" + sbox.build() + wc_dir = sbox.wc_dir + + iota_repos_path = svntest.main.current_repo_url + '/iota' + target_wc_path = os.path.join(wc_dir, 'new_file'); + + svntest.actions.run_and_verify_svn(None, None, [], 'cp', + iota_repos_path, target_wc_path) + + svntest.actions.run_and_verify_svn(None, None, [], 'diff', wc_dir) + + ######################################################################## # Run the tests @@ -1130,6 +1148,7 @@ url_copy_parent_into_child, wc_copy_parent_into_child, resurrect_deleted_file, + repos_to_wc_copy_a_file_and_diff, ] if __name__ == '__main__': Index: subversion/tests/clients/cmdline/merge_tests.py =================================================================== --- subversion/tests/clients/cmdline/merge_tests.py (revision 6613) +++ subversion/tests/clients/cmdline/merge_tests.py (working copy) @@ -1084,7 +1084,7 @@ # This is a regression for the enhancement added in issue #785. def merge_with_implicit_target (sbox): - "merging a file with no explicitly target path" + "merging a file, with no explicitly-specified target path" sbox.build() @@ -1318,6 +1318,49 @@ expected_status) +#---------------------------------------------------------------------- +# Issue #1297: +# A merge that creates a new file followed by an immediate diff +# The diff should succeed. + +def merge_that_creates_a_new_file_and_diff(sbox): + "Merge that creates a new file followed by a diff" + + sbox.build() + + wc_dir = sbox.wc_dir + + trunk_url = svntest.main.current_repo_url + '/A/B/E'; + + # Create a branch + svntest.actions.run_and_verify_svn(None, None, [], 'cp', + trunk_url, + svntest.main.current_repo_url + '/branch', + '-m', "Creating the Branch" + ) + + # Now we're at revision No. 2 + + svntest.actions.run_and_verify_svn(None, None, [], 'update', wc_dir) + + new_file_path = os.path.join(wc_dir, 'A', 'B', 'E', 'newfile'); + fp = open(new_file_path, 'w') + fp.write("newfile") + fp.close() + + svntest.actions.run_and_verify_svn(None, None, [], "add", new_file_path); + + svntest.actions.run_and_verify_svn(None, None, [], 'ci', '-m', "Changing the trunk.", wc_dir) + + # Now we're at revision No. 3 + branch_path = os.path.join(wc_dir, "branch") + svntest.actions.run_and_verify_svn(None, None, [], 'merge', '-r', '1:HEAD', + trunk_url, branch_path) + + svntest.actions.run_and_verify_svn(None, None, [], 'diff', branch_path) + + + ######################################################################## # Run the tests @@ -1331,9 +1374,10 @@ merge_with_implicit_target, merge_catches_nonexistent_target, merge_tree_deleted_in_target, - merge_similar_unrelated_trees, + XFail(merge_similar_unrelated_trees), merge_with_prev, XFail(merge_binary_file), + merge_that_creates_a_new_file_and_diff, # merge_one_file, # See issue #1150. # property_merges_galore, # Would be nice to have this. # tree_merges_galore, # Would be nice to have this.