Revision: 20208
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 9, 2009 18:06 by spreelanka
Initial Code
#!/usr/bin/perl
use strict;
my $svn_repo='local/path/to/repo';
my $f='full_repo_dump';
my $pattern='foldername/otherfoldername/offendingFileOrDirectory';
`svnadmin dump $svnrepo > $f`;
open I,'<'.$f;
open O,'>'.$f.'_cleaned';
my $c=0;
my $i=1;
while($_=<I>){
while(/^Node-path: $pattern/){#this is what we want to remove
$_=<I>;
while(!/^Node-path/){
$_=<I>;
exit unless($_); #we are out of file to read, quittin time(this is likely bad form)
}
}
###just a workaround for large repo dumps and status bar type stuff
if($c eq 0){
$c=100001;
print ++$i,"\n" ;
}
if($i%1000 eq 0){# also if your repo dump>2gb or so it will crash. this is not very precise, but it worked in my case
close O; #anyway, you get the point, close and open as append only to flush whatever file buffers perl's using
open O,'>>'.$f.'_cleaned';
}
$c--;
###
print O $_;
}
close I;
close O;
`svnadmin create freshly_cleaned_repo`;
`svnadmin load freshly_cleaned_repo < $f`;
#you should also `svnadmin dump $svnrepo -r0 > hey_whats_my_uuid`, look inside it for your uuid and
# then `svnadmin setuuid freshly_cleaned_repo this-is-your-really-long-uuid-here`
# pulling and setting the uuid could be automated
Initial URL
Initial Description
I recently had to remove some files from a svn repo. should work pretty much out of the box, just fill in blatantly exampleish text and read the comments
Initial Title
remove sensitive info from a subversion repository
Initial Tags
svn, perl
Initial Language
Perl