Synchronizing non-utf8 (latin-1) files with svnsync
Wednesday, April 6, 2011 10:35:02 AM
svnsync: REPORT of 'http://repo/svn%27: 200 OK (http://repo).
After a lot of investigation, and various theories it turned out the synchronization stopped because of a committed file having a filename in latin-1 format. I didn't notice this until viewing the repo thru SVN::Web.
svnsync is supposed to add support for log messages wrongly committed as latin-1 in 1.7, but I didn't see any mention of actual filenames in latin-1.
So after various attempts and asking in the #subversion channel on irc.freenode.net it hit me, that I could set up a proxy that fixed the filename in the response itself. The solution ended up being:
Enable the use of a proxy in .subversion/servers
[global]
http-proxy-host=localhost
http-proxy-port=8080
Set up a translating proxy
#!/usr/bin/perl
use HTTP::Proxy;
use HTTP::Proxy::BodyFilter::simple;
use Data::Dumper;
use Encode;
my $proxy = HTTP::Proxy->new( port => 8080 );
$proxy->push_filter(
method => 'OPTIONS, PROPFIND, GET, REPORT, MKACTIVITY, PROPPATCH, PUT, CHECKOUT, MKCOL, MOVE, COPY, DELETE, LOCK, UNLOCK, MERGE',
mime => '*/*',
response => HTTP::Proxy::BodyFilter::simple->new(
sub { warn Dumper($_[1]); ${ $_[1] } = Encode::encode_utf8( ${ $_[1] } ); }
)
);
$proxy->start;
And voila, syncing is working again! ;)













