Or pretty much make any changes to a committed revision.
You start by checking out the revision and doing an md5sum and a sha1sum on the desired file(s). You will need these hashes.
Next is to make your desired changes to the file(s) and then run another md5sum and sha1sum on them. You will need these hashes too.
Note also the file sizes in bytes if you make changes: before and after.
NOTE: It is best to use the same size in replaced values, because I haven’t found a good way to update the size. Yet…
Next, you dump the repo.
#svnadmin dump /path/to/repo > dump_file
Now you alter it. First the values:
#sed "s/password/XXXXXXXX/g" dump_file > dump_file_tmp
NOTE: see how the number of chars in the password matches the number of X’es? This is important as it keeps the file size intact.
next the hashes
#sed -e "s/orig_md5/altered_md5/" -e "s/orig_sha1/altered_sha1/" dump_file_tmp > dump_file_ok
NOTE: for both md5 and sha1.
Be careful, if you have more values, use the -e parameter to sed and pass each value as a separate expression, OR, use other file names, because if you keep changing the same dump file you will end up having only changed the last value.
Same with hashes.
Now you backup the old repo
#mv /path/to/repo /path/to/repo_backup
Create it clean
#svnadmin create /path/to/repo
And load the altered dump file
#svnadmin load dump_file_ok
Now you can verify the affected revisions to confirm the changes. All should be good, if not, you have the backup, and try again, paying much attention to every detail I wrote above.
Depending on your set, you may need to
#chown -R svn_user:svn_group /path/to/repo
and also re-checkout your working copy.
Related posts
Tags: svn