[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Why does import fail with autoprops ("inconsistent eol style")?

From: Stefan Sperling <stsp_at_elego.de>
Date: Tue, 22 Feb 2011 19:35:54 +0100

When trying to 'svn import' files that have a mixed eol style,
and at the same time using autoprops to set an svn:eol-style property
with value 'native' on this file, svn import aborts with an "Inconsistent
line ending style" error. Is there any specific reason for this?
Can't we just normalize the file to LF (i.e. the repository normal form)?

It's a nuisance when migrating data from other version control systems
into Subversion, especially if a lot of files are affected and the old
system doesn't support handling files with mixed newlines in a smart way.
To apply autoprops in this case another checkout/svn_apply_autoprops/commit
cycle is needed, or manual translation of the affected files is required
before running the import, both of which can take a long time with large
data sets.

The decision to make the import fail in this case is made in this part
of the code, but I can't find any rationale for it (gstein wrote this
in r875482):

subversion/libsvn_client/commit.c:
static svn_error_t *
send_file_contents(const char *path,
                   void *file_baton,
                   const svn_delta_editor_t *editor,
                   apr_hash_t *properties,
                   unsigned char *digest,
                   apr_pool_t *pool)
{

[...]

      /* If we have EOL styles or keywords, then detranslate the file. */
      if (svn_subst_translation_required(eol_style, eol, keywords,
                                         FALSE, TRUE))
        {
          svn_boolean_t repair = FALSE;

          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,
                                                 keywords,
                                                 FALSE /* expand */,
                                                 pool);
        }

Back in 1.5.x this was even hardcoded to never repair (ehu added
this in r857528):

  if (svn_subst_translation_required(eol_style, eol, keywords

    {
      const char *temp_dir;

      /* Now create a new tempfile, and open a stream to it.

      SVN_ERR(svn_io_temp_dir(&temp_dir, pool));
      SVN_ERR(svn_io_open_unique_file2
              (NULL, &tmpfile_path,
               svn_path_join(temp_dir, "svn-import", pool),
               ".tmp", svn_io_file_del_on_pool_cleanup, pool)

      SVN_ERR(svn_subst_translate_to_normal_form
              (path, tmpfile_path, eol_style, eol, FALSE,
               keywords, special, pool));

Is this just a matter of 'not-implemented' or is there a technical
reason why it can't be done?

Thanks,
Stefan
Received on 2011-02-22 19:36:34 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.