wiki:obliterate_svn_file

How do I remove a file from svn (and all of it's revisions)?

This page is designed for MFPL administrators. Special permissions are required to execute these steps. If you have a file you would like removed from our subversion repository, please open a ticket to request it's removal.

First, check the docs to see if svn obliterate has been implemented. As of this writing, it has not been implemented.

To manually obliterate a file, follow these steps on moses.mayfirst.org (aka svn.mayfirst.org). Replace $GROUP with the name of the group whose repo has the file you want to obliterate.

mkdir /srv/backup
cd /srv/backup
cp -rp /srv/svn/$GROUP $GROUP.full.backup
svnadmin dump /srv/svn/$GROUP > $GROUP.dump
grep "file/or/dir/to/delete" $GROUP.dump # check output for exact path to pass to next command
cat $GROUP.dump | svndumpfilter exclude path/to/exclude > $GROUP.clean.dump
grep "file/or/dir/to/delete" mfpl.clean.dump #make sure it's really gone
mv /home/$GROUP/.ssh/authorized_keys{,.off} # make sure nobody uses the repo
rm -rf /srv/svn/$GROUP
svnadmin create /srv/svn/$GROUP
cp $GROUP.full.backup/hooks/* /srv/svn/$GROUP/hooks/
svnadmin load /srv/svn/$GROUP < $GROUP.clean.dump
chgrp -R $GROUP /srv/svn/$GROUP
find /srv/svn/$GROUP -perm -u+w -exec chmod g+w '{}' ';'
mv /home/$GROUP/.ssh/authorized_keys{.off,}

Note: if you are removing a file or directory from the MFPL repo or any repo that is synchronizing to a trac installation, you need to repeat this process on the repo feeding the trac installation.

Here's a sample output of running these commands on moses, the server running the MFPL trac installation (note - because it's on moses, it's a little different than the commands in the above example which are designed to be run on allende, the svn server). I used the --quiet option so the whole session could be copied with less noise. Also, the initial backup was made earlier in the session.

0 moses:/srv/svn/backup# ls
mfpl.full.backup
0 moses:/srv/svn/backup# svnadmin dump --quiet /srv/svn/mfpl > mfpl.dump
0 moses:/srv/svn/backup# grep "mass_email/log.txt" mfpl.dump
Node-path: trunk/seso/basebuilder/databases/seso/scripts/mass_email/log.txt
Node-path: trunk/seso/basebuilder/databases/seso/scripts/mass_email/log.txt.sample
Node-path: trunk/seso/basebuilder/databases/seso/scripts/mass_email/log.txt
Node-path: tags/seso/4/basebuilder/databases/seso/scripts/mass_email/log.txt
0 moses:/srv/svn/backup# cat mfpl.dump | svndumpfilter --quiet exclude trunk/seso/basebuilder/databases/seso/scripts/mass_email/log.txt > mfpl.clean.dump
0 moses:/srv/svn/backup# cat mfpl.clean.dump | svndumpfilter --quiet exclude tags/seso/4/basebuilder/databases/seso/scripts/mass_email/log.txt > mfpl.clean.final.dump
0 moses:/srv/svn/backup# grep "mass_email/log.txt" mfpl.clean.final.dump
1 moses:/srv/svn/backup# mv /home/svnsync/.ssh/authorized_keys{,.off}
0 moses:/srv/svn/backup# rm -rf /srv/svn/mfpl
0 moses:/srv/svn/backup# svnadmin create /srv/svn/mfpl
0 moses:/srv/svn/backup# cp mfpl.full.backup/hooks/* /srv/svn/mfpl/hooks/
cp: overwrite `/srv/svn/mfpl/hooks/post-commit.tmpl'? y
cp: overwrite `/srv/svn/mfpl/hooks/post-lock.tmpl'? y
cp: overwrite `/srv/svn/mfpl/hooks/post-revprop-change.tmpl'? y
cp: overwrite `/srv/svn/mfpl/hooks/post-unlock.tmpl'? y
cp: overwrite `/srv/svn/mfpl/hooks/pre-commit.tmpl'? y
cp: overwrite `/srv/svn/mfpl/hooks/pre-lock.tmpl'? y
cp: overwrite `/srv/svn/mfpl/hooks/pre-revprop-change.tmpl'? y
cp: overwrite `/srv/svn/mfpl/hooks/pre-unlock.tmpl'? y
cp: overwrite `/srv/svn/mfpl/hooks/start-commit.tmpl'? y
0 moses:/srv/svn/backup# svnadmin load --quiet /srv/svn/mfpl < mfpl.clean.final.dump
0 moses:/srv/svn/backup# chgrp -R svnsync:svnsync /srv/svn/mfpl
chgrp: invalid group `svnsync:svnsync'
1 moses:/srv/svn/backup# chown -R svnsync:svnsync /srv/svn/mfpl
0 moses:/srv/svn/backup# mv /home/svnsync/.ssh/authorized_keys{.off,}
0 moses:/srv/svn/backup#

Thanks to Rob Gonada for spelling out the steps to take.

Last modified 11 years ago Last modified on Sep 2, 2008, 10:54:44 AM