Script to obliterate the most recent revision(s)
From: Julian Foad <julianfoad_at_apache.org>
Date: Thu, 22 Mar 2018 22:24:56 +0000
This question keeps coming up and I feel we should provide an accurate
Any corrections to my current best effort, below?
R=(the highest wanted revision number)
1. Any WCs (or parts of WCs) at a revision > R should first be updated
2. on the server:
Use any external means to prevent write access to the repo.
(You cannot use 'svnadmin freeze' with the commands below as the script,
Let's assume you're in the repo dir and running Bash or a similar shell.
Collect some info:
$ R=998902 # the desired new head revision
* set the 'current' file to R, or (arguably slightly easier/safer)
$ rm db/current
* delete the discarded revision file(s):
$ for F in $(seq $((R+1)) $OLD_R); do rm -f db/revs/*/$F
* clear out any references to discarded revs in 'rep-cache.db'
You'll need the 'sqlite3' command-line utility program, which you may
$ sqlite3 db/rep-cache.db "delete from rep_cache where revision > $R"
* delete any pending transactions
$ svnadmin rmtxns . $OLD_TXNS
$ svnadmin recover .
(Q: Does 'recover' do any useful magic beyond recreating the 'current'
> 2c. un-freeze the repo
'svnadmin verify' doesn't detect if the rep-cache still contains too-new
'svnadmin recover' could do the rep-cache recovery step. Any reason it
This is an archived mail posted to the Subversion Dev mailing list.