How can I fix the SVN import line endings error?
The first option of the answer of @ventura10 sounded good but didn't work for me. The sed
command changed some versioned content outside the properties section resulting in md5 mismatches while loading the dump.
Because my repository has no properties with binary content I changed the sed command to correct all properties and not only svn:log
and svn:ignore
. I was also sure that no versioned file contained a line starting with Prop-content-length:
. Otherwise I would have got an error when loading the dump.
sed -e '/^Prop-content-length: /,/^PROPS-END$/ s/^M/ /' svn.dump > svn.dump.repaired
It's important to replace ^M
with [blank]
, because the size of the property value must not change.
The note of @ventura10 is still valid:
^M is a control character, that means 0D in hex. To get it use ^V^M (control V control M) instead ^M (circumflex M or control M)
It's hard to believe that upgrading an existing repository from svn 1.4 to svn 1.7 makes this step nessecary, but I've found no other way to get rid of the carriage returns that are no longer accepted since svn 1.6.
You have 2 options, repair the source or disable prop validation.
Repairing the source (svn:log and svn:ignore):
sed -e '/^svn:log$/,/^K / s/^M/ /' -e '/^svn:ignore$/,/^PROPS-END$/ s/^M/\n/' archive.svn > repaired-archive.svn
svnadmin load . < repaired-archive.svn
Where ^M is a control character, that means 0D in hex. To get it use ^V^M (control V control M) instead ^M (circumflex M or control M)
Disabling prop validation:
svnadmin load --bypass-prop-validation . < archive.svn