Author: stsp
Date: Tue Nov 22 22:18:37 2011
New Revision: 1205193

URL: http://svn.apache.org/viewvc?rev=1205193&view=rev
Log:
Do not throw a fatal error during 'svn import' if a file with inconsistent
eol-style has svn:eol-style set to 'native'. Also, improve an error message.

For discussion, see this thread on dev@ from last February:
  From: Stefan Sperling
  To: dev@
  Date: Tue, 22 Feb 2011 19:35:54 +0100
  Subject: Why does import fail with autoprops ("inconsistent eol style")?
  Message-ID: <[email protected]>
  http://svn.haxx.se/dev/archive-2011-02/0767.shtml

Reminded today in #svn IRC by user "alecat".

* subversion/libsvn_client/commit.c
  (send_file_contents): Repair newlines also if eol-style is 'native',
   not only if it is some fixed style. Improve error message in the case
   where the value of the svn:eol-style property cannot be parsed.

Modified:
    subversion/trunk/subversion/libsvn_client/commit.c

Modified: subversion/trunk/subversion/libsvn_client/commit.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit.c?rev=1205193&r1=1205192&r2=1205193&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit.c Tue Nov 22 22:18:37 2011
@@ -145,19 +145,22 @@ send_file_contents(const char *path,
       if (svn_subst_translation_required(eol_style, eol, keywords,
                                          FALSE, TRUE))
         {
-          svn_boolean_t repair = FALSE;
+          if (eol_style == svn_subst_eol_style_unknown)
+            return svn_error_createf(SVN_ERR_IO_UNKNOWN_EOL, NULL,
+                                    _("%s property on '%s' contains "
+                                      "unrecognized EOL-style '%s'"),
+                                    SVN_PROP_EOL_STYLE, path,
+                                    eol_style_val->data);
 
+          /* We're importing, so translate files with 'native' eol-style to
+           * repository-normal form, not to this platform's native EOL. */
           if (eol_style == svn_subst_eol_style_native)
             eol = SVN_SUBST_NATIVE_EOL_STR;
-          else if (eol_style == svn_subst_eol_style_fixed)
-            repair = TRUE;
-          else if (eol_style != svn_subst_eol_style_none)
-            return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL, NULL);
 
           /* Wrap the working copy stream with a filter to detranslate it. */
           contents = svn_subst_stream_translated(contents,
                                                  eol,
-                                                 repair,
+                                                 TRUE /* repair */,
                                                  keywords,
                                                  FALSE /* expand */,
                                                  pool);


Reply via email to