Index: subversion/tests/cmdline/patch_tests.py =================================================================== --- subversion/tests/cmdline/patch_tests.py (revision 915715) +++ subversion/tests/cmdline/patch_tests.py (arbetskopia) @@ -1352,6 +1352,95 @@ 1, # dry-run '--reverse-diff') +def patch_different_eol_without_props(sbox): + "apply a patch with different eols and no props" + + sbox.build() + wc_dir = sbox.wc_dir + + patch_file_path = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir))[1] + mu_path = os.path.join(wc_dir, 'A', 'mu') + + if os.name == 'nt': + crlf = '\n' + else: + crlf = '\r\n' + + eols = [crlf, '\015', '\n', '\012'] + + for target_eol in eols: + i = 0 + for patch_eol in eols: + i = i + 1 + print "Testing nr " + str(i) + " of eols list for patch_eol" + mu_contents = [ + #"Dear internet user,", target_eol, + target_eol, + "We wish to congratulate you over your email success in our computer", target_eol, + "Balloting. This is a Millennium Scientific Electronic Computer Draw", target_eol, + "in which email addresses were used. All participants were selected", target_eol, + "through a computer ballot system drawn from over 100,000 company", target_eol, + "and 50,000,000 individual email addresses from all over the world.", target_eol, + "It is a promotional program aimed at encouraging internet users;", target_eol, + target_eol, + ] + + # Set mu contents + svntest.main.file_write(mu_path, ''.join(mu_contents)) + + unidiff_patch = [ + "Index: mu\n", + "===================================================================\n", + "--- A/mu\t(revision 0)\n", + "+++ A/mu\t(revision 0)\n", + "@@ -1,6 +1,7 @@\n", + patch_eol, + " We wish to congratulate you over your email success in our computer", patch_eol, + " Balloting. This is a Millennium Scientific Electronic Computer Draw", patch_eol, + "+A new line here", patch_eol, + " in which email addresses were used. All participants were selected", patch_eol, + " through a computer ballot system drawn from over 100,000 company", patch_eol, + " and 50,000,000 individual email addresses from all over the world.", patch_eol, + ] + + mu_contents = [ + #"Dear internet user,", target_eol, + target_eol, + "We wish to congratulate you over your email success in our computer", target_eol, + "Balloting. This is a Millennium Scientific Electronic Computer Draw", target_eol, + "A new line here", target_eol, + "in which email addresses were used. All participants were selected", target_eol, + "through a computer ballot system drawn from over 100,000 company", target_eol, + "and 50,000,000 individual email addresses from all over the world.", target_eol, + "It is a promotional program aimed at encouraging internet users;", target_eol, + target_eol, + ] + + svntest.main.file_write(patch_file_path, ''.join(unidiff_patch)) + + expected_output = [ + 'G %s\n' % os.path.join(wc_dir, 'A', 'mu'), + ] + expected_disk = svntest.main.greek_state.copy() + expected_disk.tweak('A/mu', contents=''.join(mu_contents)) + + expected_status = svntest.actions.get_virginal_state(wc_dir, 1) + expected_status.tweak('A/mu', status='M ', wc_rev=1) + + 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 + + expected_output = ["Reverted '" + mu_path + "'\n"] + svntest.actions.run_and_verify_svn(None, expected_output, [], 'revert', '-R', wc_dir) + ######################################################################## #Run the tests @@ -1367,6 +1456,7 @@ patch_keywords, patch_with_fuzz, patch_reverse, + patch_different_eol_without_props, ] if __name__ == '__main__':