Index: subversion/tests/cmdline/import_tests.py =================================================================== --- subversion/tests/cmdline/import_tests.py (revision 20154) +++ subversion/tests/cmdline/import_tests.py (working copy) @@ -290,7 +290,67 @@ '--username', svntest.main.wc_author, '--password', svntest.main.wc_passwd, empty_dir) +#---------------------------------------------------------------------- +# test for issue 2433: "import" does not handle eol-style correctly +def import_eol_style(sbox): + "import should honor the eol-style property" + + sbox.build() + wc_dir = sbox.wc_dir + + # setup a custom config, we need autoprops + config_contents = '''\ +[miscellany] +enable-auto-props = yes + +[auto-props] +*.dsp = svn:eol-style=CRLF +''' + svntest.main.create_config_dir(svntest.main.config_dir, config_contents) + + # create a new file and import it + file_name = "test.dsp" + file_path = os.path.join(wc_dir, file_name) + imp_dir_path = os.path.join(wc_dir, 'dir') + imp_file_path = os.path.join(imp_dir_path, file_name) + + os.mkdir(imp_dir_path, 0755) + open(imp_file_path, 'w').write("This is file test.dsp.\n") + + svntest.actions.run_and_verify_svn(None, None, [], 'import', + '--username', svntest.main.wc_author, + '--password', svntest.main.wc_passwd, + '-m', 'Log message for new import', + imp_dir_path, + svntest.main.current_repo_url) + + svntest.main.run_svn(None, 'update', wc_dir) + + # change part of the file + svntest.main.file_append(file_path, "Extra line\n") + + # get a diff of the file, if the eol style is handled correctly, we'll + # only see our added line here. + # Before the issue was fixed, we would have seen something like this: + # @@ -1 +1,2 @@ + # -This is file test.dsp. + # +This is file test.dsp. + # +Extra line + expected_output = [ + "Index: svn-test-work/working_copies/import_tests-5/test.dsp\n", + "===================================================================\n", + "--- svn-test-work/working_copies/import_tests-5/test.dsp\t(revision 2)\n", + "+++ svn-test-work/working_copies/import_tests-5/test.dsp\t(working copy)\n", + "@@ -1 +1,2 @@\n", + " This is file test.dsp.\n", + "+Extra line\n" + ] + + svntest.actions.run_and_verify_svn(None, expected_output, [], + 'diff', + file_path) + #---------------------------------------------------------------------- ######################################################################## # Run the tests @@ -302,6 +362,7 @@ import_ignores, import_avoid_empty_revision, import_no_ignores, + import_eol_style, ] if __name__ == '__main__':