从subversion存储库中删除敏感信息
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从subversion存储库中删除敏感信息相关的知识,希望对你有一定的参考价值。
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
#!/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
以上是关于从subversion存储库中删除敏感信息的主要内容,如果未能解决你的问题,请参考以下文章