Author: sbutler
Date: Mon Jun 6 15:58:35 2011
New Revision: 1132686
URL: http://svn.apache.org/viewvc?rev=1132686&view=rev
Log:
Improve the fix for issue 3899 "Auto-resolve conflicts at wc-wc copy/move
destination", for copied text-conflicted files.
* subversion/libsvn_wc/copy.c
(copy_versioned_file): For a text conflict, take the "working" file, if
it exists.
* subversion/tests/cmdline/copy_tests.py
(copying_conflicts): Remove XFAIL and tweak a comment.
Modified:
subversion/trunk/subversion/libsvn_wc/copy.c
subversion/trunk/subversion/tests/cmdline/copy_tests.py
Modified: subversion/trunk/subversion/libsvn_wc/copy.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/copy.c?rev=1132686&r1=1132685&r2=1132686&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/copy.c (original)
+++ subversion/trunk/subversion/libsvn_wc/copy.c Mon Jun 6 15:58:35 2011
@@ -220,6 +220,10 @@ copy_deleted_node(svn_wc__db_t *db,
otherwise copy both the versioned metadata and the filesystem node (even
if it is the wrong kind, and recursively if it is a dir).
+ If the versioned file has a text conflict, and the .mine file exists in
+ the filesystem, copy the .mine file to DST_ABSPATH. Otherwise, copy the
+ versioned file itself.
+
This also works for versioned symlinks that are stored in the db as
svn_wc__db_kind_file with svn:special set. */
static svn_error_t *
@@ -253,8 +257,46 @@ copy_versioned_file(svn_wc__db_t *db,
{
const char *tmp_dst_abspath;
svn_node_kind_t disk_kind;
+ const apr_array_header_t *conflicts;
+ const char *conflict_working = NULL;
+ const char *my_src_abspath = NULL;
+ int i;
+
+ /* By default, take the copy source as given. */
+ my_src_abspath = src_abspath;
+
+ /* Is there a text conflict at the source path? */
+ SVN_ERR(svn_wc__db_read_conflicts(&conflicts, db, src_abspath,
+ scratch_pool, scratch_pool));
- SVN_ERR(copy_to_tmpdir(&tmp_dst_abspath, &disk_kind, src_abspath,
+ for (i = 0; i < conflicts->nelts; i++)
+ {
+ const svn_wc_conflict_description2_t *desc;
+
+ desc = APR_ARRAY_IDX(conflicts, i,
+ const svn_wc_conflict_description2_t*);
+
+ if (desc->kind == svn_wc_conflict_kind_text)
+ {
+ conflict_working = desc->my_abspath;
+ break;
+ }
+ }
+
+ if (conflict_working)
+ {
+ svn_node_kind_t working_kind;
+
+ SVN_DBG(("Theres a working file: %s\n", conflict_working));
+ /* Does the ".mine" file exist? */
+ SVN_ERR(svn_io_check_path(conflict_working, &working_kind,
+ scratch_pool));
+
+ if (working_kind == svn_node_file)
+ my_src_abspath = conflict_working;
+ }
+
+ SVN_ERR(copy_to_tmpdir(&tmp_dst_abspath, &disk_kind, my_src_abspath,
tmpdir_abspath,
TRUE, /* recursive */
cancel_func, cancel_baton, scratch_pool));
Modified: subversion/trunk/subversion/tests/cmdline/copy_tests.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/copy_tests.py?rev=1132686&r1=1132685&r2=1132686&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/copy_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/copy_tests.py Mon Jun 6 15:58:35
2011
@@ -5221,7 +5221,6 @@ def case_only_rename(sbox):
# Test that the necessary deletes and adds are present in status.
svntest.actions.run_and_verify_status(wc_dir, expected_status)
-@XFail()
@Issue(3899)
def copying_conflicts(sbox):
"""copying conflicts"""
@@ -5359,8 +5358,8 @@ def copying_conflicts(sbox):
})
svntest.actions.run_and_verify_status(wc('copy-dest'), expected_status)
- # Only the local changes remain at the copy destinations.
- ### Currently fails because alpha and B/E/alpha contain conflict-marker text.
+ # Only the local changes appear at the copy destinations. Note that
+ # B/E/beta had been resolved via marker-file deletion before the copy.
expected_disk = svntest.wc.State('', {
'B/E/alpha' : Item(contents="This is the file 'alpha'.\n"
"Local edit\n"),