You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2010/09/07 21:49:02 UTC
svn commit: r993504 -
/subversion/trunk/subversion/tests/cmdline/patch_tests.py
Author: dannas
Date: Tue Sep 7 19:49:02 2010
New Revision: 993504
URL: http://svn.apache.org/viewvc?rev=993504&view=rev
Log:
Add patch test for adding empty files.
Such files can only be applied if the diff uses the git extensions to
the unidiff format.
* subversion/tests/cmdline/patch_tests.py
(patch_git_add_file): New.
(test_list): Add patch_git_add_file.
Modified:
subversion/trunk/subversion/tests/cmdline/patch_tests.py
Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=993504&r1=993503&r2=993504&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Tue Sep 7 19:49:02 2010
@@ -2976,6 +2976,43 @@ def patch_prop_with_fuzz(sbox):
1, # check-props
1) # dry-run
+def patch_git_add_file(sbox):
+ "patch that contains empty files"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+ patch_file_path = make_patch_path(sbox)
+
+ new_path = os.path.join(wc_dir, 'new')
+
+ unidiff_patch = [
+ "Index: new\n",
+ "===================================================================\n",
+ "diff --git a/new b/new\n",
+ "new file mode 10644\n",
+ ]
+
+ svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+ expected_output = [
+ 'A %s\n' % os.path.join(wc_dir, 'new'),
+ ]
+ expected_disk = svntest.main.greek_state.copy()
+ expected_disk.add({'new' : Item(contents="")})
+
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+ expected_status.add({'new' : Item(status='A ', wc_rev=0)})
+
+ expected_skip = wc.State('', { })
+
+ svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
+ expected_output,
+ expected_disk,
+ expected_status,
+ expected_skip,
+ None, # expected err
+ 1, # check-props
+ 1) # dry-run
########################################################################
#Run the tests
@@ -3005,6 +3042,7 @@ test_list = [ None,
patch_add_path_with_props,
patch_prop_offset,
patch_prop_with_fuzz,
+ patch_git_add_file,
]
if __name__ == '__main__':