You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/10/06 14:31:43 UTC
svn commit: r1707034 - in /subversion/trunk/subversion:
libsvn_client/patch.c tests/cmdline/patch_tests.py
Author: rhuijben
Date: Tue Oct 6 12:31:43 2015
New Revision: 1707034
URL: http://svn.apache.org/viewvc?rev=1707034&view=rev
Log:
Describe adds and removes in the 'svn patch' reject file headers.
* subversion/libsvn_client/patch.c
(init_patch_target): Tweak reject file header based on whether we
are trying to add or remove the file.
* subversion/tests/cmdline/patch_tests.py
(patch_delete_modified,
patch_git_symlink,
patch_like_git_symlink): Update expected rejectfile.
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=1707034&r1=1707033&r2=1707034&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Tue Oct 6 12:31:43 2015
@@ -1241,13 +1241,6 @@ init_patch_target(patch_target_t **patch
svn_io_file_del_none,
result_pool, scratch_pool));
- /* The reject file needs a diff header. */
- SVN_ERR(svn_stream_printf(target->reject_stream, scratch_pool,
- "--- %s" APR_EOL_STR
- "+++ %s" APR_EOL_STR,
- target->canon_path_from_patchfile,
- target->canon_path_from_patchfile));
-
/* Handle properties. */
if (! target->skipped)
{
@@ -1425,6 +1418,24 @@ init_patch_target(patch_target_t **patch
target->deleted = TRUE;
}
+ if (target->reject_stream != NULL)
+ {
+ /* The reject file needs a diff header. */
+ const char *left_src = target->canon_path_from_patchfile;
+ const char *right_src = target->canon_path_from_patchfile;
+
+ /* Handle moves specifically? */
+ if (target->added)
+ left_src = "/dev/null";
+ if (target->deleted)
+ right_src = "/dev/null";
+
+ SVN_ERR(svn_stream_printf(target->reject_stream, scratch_pool,
+ "--- %s" APR_EOL_STR
+ "+++ %s" APR_EOL_STR,
+ left_src, right_src));
+ }
+
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=1707034&r1=1707033&r2=1707034&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Tue Oct 6 12:31:43 2015
@@ -5341,7 +5341,7 @@ def patch_delete_modified(sbox):
expected_skip = wc.State('', { })
reject_file_contents = [
"--- A/B/E/beta\n",
- "+++ A/B/E/beta\n",
+ "+++ /dev/null\n",
"@@ -1,1 +0,0 @@\n",
"-This is the file 'beta'.\n",
]
@@ -7016,7 +7016,7 @@ def patch_git_symlink(sbox):
expected_disk.add({
'link-to-iota.svnpatch.rej': Item(
contents='--- link-to-iota\n'
- '+++ link-to-iota\n'
+ '+++ /dev/null\n'
'@@ -1,1 +0,0 @@\n'
'-A/mu\n'
'\\ No newline at end of file\n'),
@@ -7136,7 +7136,7 @@ def patch_like_git_symlink(sbox):
expected_disk.add({
'link-to-iota.svnpatch.rej': Item(
contents='--- link-to-iota\n'
- '+++ link-to-iota\n'
+ '+++ /dev/null\n'
'@@ -1,1 +0,0 @@\n'
'-A/mu\n'
'\\ No newline at end of file\n'),