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

RE: Converting BDB to FSFS

From: Goddard Lee <lee.goddard_at_easa.eu.int>
Date: 2005-08-30 14:44:50 CEST

From: Flanakin Michael C Ctr HQ OSSG/OMR
[mailto:Michael.Flanakin@Gunter.AF.mil]

> I'm trying to convert a repository from BDB to FSFS.
> Is there a utility that can do this?

Probably, but this script is what I used with success. YMMV....HTH!

Lee Goddard
Internet Application Development, European Aviation Safety Agency

T: +49 221 89990 3221
E: Lee.Goddard@EASA.EU.int

#!/usr/bin/perl -w
#
# Perl script to convert an svn repository
# Author: Lee Goddard (lee.goddar@easa.eu.int)
# Last Updated: 18 August 2005
#

use Cwd;
use strict;
use warnings;
use Data::Dumper;

my $root = '/var/repositories/';

opendir DIR, $root or die "can't opendir $root: $!";
my %dirs = map { $_ => '' } grep { !/(\.|2)$/ && -d "$root/$_" } readdir
DIR;
closedir DIR;

foreach (keys %dirs){
 open FILE,"$_/db/fs-type" or die "Can't open $_/db/fs-type: $!";
 read FILE, $dirs{$_}, -s FILE;
 chomp $dirs{$_};
 close FILE;
}

foreach my $orig (keys %dirs){
 next if $dirs{$orig} eq 'fsfs';
 my $new = $orig."_new";
 warn "create $new...\n";
 `svnadmin create $root$new --fs-type fsfs`;
 die "# Error creating $new: $?\n" if $?;
 `chmod -R 775 $root$new`;
 die "# Error chmod $new: $?\n" if $?;
 `chown -R svn:dev $root$new`;
 die "# Error chown $new: $?\n" if $?;
 warn "dump | load ...\n";
 `svnadmin dump $root$orig -q | svnadmin load $root$new`;
 die "# Error dump|load $?\n" if $?;
 `mv $root$orig $root${orig}_bdb`;
 die "# Error renaming old repo $?\n" if $?;
 `mv $root$new $root$orig`;
 die "# Error renaming new repo $?\n" if $?;
}

warn "# Done.\n";
exit;

__END__

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Aug 30 14:51:47 2005

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.