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

Re: Migrating old format repositories (format 4), running into bad line endings

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Mon, 22 Aug 2016 20:52:14 +0000

Eric Johnson wrote on Mon, Aug 22, 2016 at 11:11:17 -0700:
> I've seen that other people recommend editing the dump file directly, but
> that makes me quite nervous, especially on an 8MB dump file. Hoping there's
> a better way.

You could just pass --bypass-prop-validation to 'svnadmin load'. That
will permit the load to go through, *keeping* the CRs in place.

If you care to patch the source, I think this is what you want:

[[[
Index: subversion/libsvn_repos/load-fs-vtable.c
===================================================================
--- subversion/libsvn_repos/load-fs-vtable.c (revision 1757264)
+++ subversion/libsvn_repos/load-fs-vtable.c (working copy)
@@ -871,6 +871,15 @@ set_node_property(void *baton,
         }
     }
 
+ if (svn_prop_needs_translation(name))
+ if (strchr(value->data, '\r'))
+ {
+ apr_array_header_t *parts = svn_cstring_split(value->data, "\r", FALSE,
+ nb->pool);
+ value = svn_string_create(svn_cstring_join(parts, "", nb->pool),
+ nb->pool);
+ }
+
   return change_node_prop(rb->txn_root, nb->path, name, value,
                           pb->validate_props, nb->pool);
 }
]]]

I have not tested this patch, so while I *think* it's correct, it might
be buggy in some way. If you use it, then you should verify manually
that it effected the correct transformation and didn't have unexpected
side effects.

The patch is against 1.9.x.

I haven't used the svn_*translate APIs pointed to by
svn_prop_needs_translation()'s docstring because those transcode, which
wouldn't be appropriate in this case (we can't assume the dumpfile data
is in the system encoding of the system the 'load' is done on).

And again: the patch is completely untested; it is *probably* correct,
but don't trust it to the same degree you trust our packaged stable
releases. Until feedback on list blesses it as stable, validate its
effect manually.

Sorry for the caveats,

HTH,

Daniel

P.S. For anyone running into this in the archives: this patch only
affects node properties; it doesn't touch revision properties.
Received on 2016-08-22 22:52:31 CEST

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

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