/ Published in: Perl
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
should work pretty much out of the box, just fill in blatantly exampleish text and read the comments
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/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`; my $c=0; my $i=1; while($_=<I>){ while(/^Node-path: $pattern/){#this is what we want to remove $_=<I>; while(!/^Node-path/){ $_=<I>; } } ###just a workaround for large repo dumps and status bar type stuff if($c eq 0){ $c=100001; } 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 } $c--; ### } 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