Hi, attached is a new version of the patch which adds a regression test (the actual patch/fix was left unchanged). The regression test was tested against 1.9.4, 1.9.x and trunk r1743999.
I also tried to run the test against 1.8.16 but there it fails (didn't
investigate in detail).
Trunk r1758069 caused some build issues on my machine. Therefore I
couldn't validate/check the patch against the latest trunk (maybe it's
just some local issue with my build machine rather than some actual
problem on trunk - didn't look into that yet).
[[[
Fix issue #4647 by resolving the error case for binary file conflicts
selecting
to use the full local version, by allowing using the local file, if no
merged
file is present.
* subversion/libsvn_wc/conflicts.c
(build_text_conflict_resolve_items): in case mine_abspath is null, take
local_abspath instead in case of
svn_wc_conflict_choose_mine_full
* subversion/tests/cmdline/resolve_tests.py
(automatic_binary_conflict_resolution): add new regression test
Suggested by: stsp
]]]
Regards,
Stefan
Index: subversion/libsvn_wc/conflicts.c
===================================================================
--- subversion/libsvn_wc/conflicts.c (revision 1758102)
+++ subversion/libsvn_wc/conflicts.c (working copy)
@@ -1623,7 +1623,14 @@
}
case svn_wc_conflict_choose_mine_full:
{
- install_from_abspath = mine_abspath;
+ /* In case of selecting to resolve the conflict choosing the full
+ own file, allow the text conflict resolution to just take the
+ existing local file if no merged file was present (case: binary
+ file conflicts do not generate a locally merge file).
+ */
+ install_from_abspath = mine_abspath
+ ? mine_abspath
+ : local_abspath;
break;
}
case svn_wc_conflict_choose_theirs_conflict:
Index: subversion/tests/cmdline/resolve_tests.py
===================================================================
--- subversion/tests/cmdline/resolve_tests.py (revision 1758102)
+++ subversion/tests/cmdline/resolve_tests.py (working copy)
@@ -598,7 +598,68 @@
svntest.main.run_svn(None, 'merge', '-c4,3', '^/iota', 'iota',
'--accept=theirs-conflict')
+#----------------------------------------------------------------------
+# Test for issue #4647 'auto resolution mine-full fails on binary file'
+@XFail()
+@Issue(4647)
+def automatic_binary_conflict_resolution(sbox):
+ "resolve -R --accept [base | mf | tf] binary file"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ # Some paths we'll care about
+ A_COPY_path = os.path.join(wc_dir, "A_COPY")
+
+ # Add a binary file to the project in revision 2.
+ theta_contents = open(os.path.join(sys.path[0], "theta.bin"), 'rb').read()
+ theta_path = sbox.ospath('A/theta')
+ svntest.main.file_write(theta_path, theta_contents, 'wb')
+ svntest.main.run_svn(None, 'add', theta_path)
+ svntest.main.run_svn(None, 'commit', '-m', 'log msg', wc_dir)
+
+ # Branch A to A_COPY in revision 3.
+ svntest.main.run_svn(None, 'copy', wc_dir + "/A", A_COPY_path)
+ svntest.main.run_svn(None, 'commit', '-m', 'log msg', wc_dir)
+
+ # Modify the binary file on trunk and in the branch, so that both versions
+ # differ.
+ theta_branch_path = sbox.ospath('A_COPY/theta')
+ svntest.main.file_append_binary(theta_path, theta_contents)
+ svntest.main.run_svn(None, 'commit', '-m', 'log msg', wc_dir)
+ svntest.main.file_append_binary(theta_branch_path, theta_contents)
+ svntest.main.file_append_binary(theta_branch_path, theta_contents)
+ svntest.main.run_svn(None, 'commit', '-m', 'log msg', wc_dir)
+
+ # Run an svn update now to prevent mixed-revision working copy [1:4] error.
+ svntest.main.run_svn(None, 'update', wc_dir)
+
+
+ def do_binary_conflicting_merge():
+ svntest.actions.run_and_verify_svn(None, [],
+ 'revert', '--recursive', A_COPY_path)
+ svntest.main.run_svn(None, 'merge', sbox.repo_url + "/A/theta", wc_dir +
"/A_COPY/theta")
+
+ # Test 'svn resolve -R --accept base'
+ do_binary_conflicting_merge()
+ svntest.actions.run_and_verify_resolve([A_COPY_path],
+ '-R', '--accept', 'base',
+ A_COPY_path)
+
+ # Test 'svn resolve -R --accept mine-full'
+ do_binary_conflicting_merge()
+ svntest.actions.run_and_verify_resolve([A_COPY_path],
+ '-R', '--accept', 'mine-full',
+ A_COPY_path)
+
+ # Test 'svn resolve -R --accept theirs-full'
+ do_binary_conflicting_merge()
+ svntest.actions.run_and_verify_resolve([A_COPY_path],
+ '-R', '--accept', 'tf',
+ A_COPY_path)
+
+
########################################################################
# Run the tests
@@ -611,6 +672,7 @@
resolved_on_deleted_item,
theirs_conflict_in_subdir,
multi_range_merge_with_accept,
+ automatic_binary_conflict_resolution,
]
if __name__ == '__main__':
smime.p7s
Description: S/MIME Cryptographic Signature

