You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/08/21 13:36:41 UTC
svn commit: r987727 - in /subversion/trunk/subversion: libsvn_client/patch.c
tests/cmdline/patch_tests.py
Author: stsp
Date: Sat Aug 21 11:36:40 2010
New Revision: 987727
URL: http://svn.apache.org/viewvc?rev=987727&view=rev
Log:
Make an XFailing patch test pass properly.
* subversion/tests/cmdline/patch_tests.py
(patch_add_path_with_props): Expect X to be an empty file, rather than
expecting its content to be 'None'.
(test_list): Remove XFail marker from patch_add_path_with_props.
* subversion/libsvn_client/patch.c
(apply_one_patch): Don't skip targets which are empty after patching
but have had prop changes applied to them.
(install_patched_prop_targets): If the target had only prop changes and
is missing, create it and add it to version control, before attempting to
set properties. Also handle this situation in dry-run mode.
Modified:
subversion/trunk/subversion/libsvn_client/patch.c
subversion/trunk/subversion/tests/cmdline/patch_tests.py
Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=987727&r1=987726&r2=987727&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Sat Aug 21 11:36:40 2010
@@ -1881,9 +1881,11 @@ apply_one_patch(patch_target_t **patch_t
else if (patched_file.size == 0 && working_file.size == 0)
{
/* The target was empty or non-existent to begin with
- * and nothing has changed by patching.
- * Report this as skipped if it didn't exist. */
- if (target->kind_on_disk == svn_node_none)
+ * and no content was changed by patching.
+ * Report this as skipped if it didn't exist, unless in the special
+ * case of adding an empty file which has properties set on it. */
+ if (target->kind_on_disk == svn_node_none &&
+ ! target->has_prop_changes)
target->skipped = TRUE;
}
else if (patched_file.size > 0 && working_file.size == 0)
@@ -2169,7 +2171,12 @@ install_patched_prop_targets(patch_targe
apr_pool_t *iterpool;
if (dry_run)
- return SVN_NO_ERROR;
+ {
+ if (! target->has_text_changes && target->kind_on_disk == svn_node_none)
+ target->added = TRUE;
+
+ return SVN_NO_ERROR;
+ }
iterpool = svn_pool_create(scratch_pool);
@@ -2227,6 +2234,25 @@ install_patched_prop_targets(patch_targe
svn_stream_close(patched_stream);
+ /* If the patch target doesn't exist yet, the patch wants to add an
+ * empty file with properties set on it. So create an empty file and
+ * add it to version control.
+ *
+ * ### How can we tell whether the patch really wanted to create
+ * ### an empty directory? */
+ if (! target->has_text_changes && target->kind_on_disk == svn_node_none)
+ {
+ SVN_ERR(svn_io_file_create(target->local_abspath, "", scratch_pool));
+ SVN_ERR(svn_wc_add4(ctx->wc_ctx, target->local_abspath,
+ svn_depth_infinity,
+ NULL, SVN_INVALID_REVNUM,
+ ctx->cancel_func,
+ ctx->cancel_baton,
+ NULL, NULL, /* suppress notification */
+ iterpool));
+ target->added = TRUE;
+ }
+
/* ### How should we handle SVN_ERR_ILLEGAL_TARGET and
* ### SVN_ERR_BAD_MIME_TYPE?
*
Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=987727&r1=987726&r2=987727&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Sat Aug 21 11:36:40 2010
@@ -2603,7 +2603,8 @@ def patch_add_path_with_props(sbox):
expected_disk = svntest.main.greek_state.copy()
expected_disk.add({'new': Item(contents="This is the file 'new'\n",
props={'added' : added_prop_contents})})
- expected_disk.add({'X': Item(props={'added' : added_prop_contents})})
+ expected_disk.add({'X': Item(contents="",
+ props={'added' : added_prop_contents})})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.add({'new': Item(status='A ', wc_rev='0')})
expected_status.add({'X': Item(status='A ', wc_rev='0')})
@@ -3001,7 +3002,7 @@ test_list = [ None,
patch_with_properties,
patch_same_twice,
XFail(patch_dir_properties),
- XFail(patch_add_path_with_props),
+ patch_add_path_with_props,
patch_prop_offset,
patch_prop_with_fuzz,
]