Repair corrupted SVN repository

后端 未结 2 1953
一整个雨季
一整个雨季 2021-02-06 06:26

I am using svnX (0.9.13) on Mac OS X Lion (10.7.2 11C74) and have seem to have, what I believe, is a corrupted SVN repository. I have searched the site for similar questions and

2条回答
  •  温柔的废话
    2021-02-06 07:16

    When you have a corrupt repository, your only real chance in saving the information is to do a dump and load. If you're lucky, doing a dump and load will sometimes correct the corruption.

    If not, you can use the -r : parameter on the dump to skip over the bad revisions. You can create several dump files and merge them into a single repository, so you can skip over the bad revision numbers. I've noticed that each dump file starts with a complete revision of the repository at that revision, and the dump/load process is usually smart enough not to double up changes.

    In fact, I believe you can even put several dumps into a single dump file without too many problems. The following should skip over revisions 1001 and 1204 which are bad revisions:

    $ svnadmin dump -r1:1000 my_repos > dumpfile.txt
    $ svnadmin dump --incremental -r1002:1203 my_repos >> dumpfile.txt
    $ svnadmin dump --incremental -r1205:HEAD my_repos >> dumpfile.txt
    $ svnadmin load my_repos2 < dumpfile.txt
    

    There are several Subversion backup scripts that backup the repository by taking dumps of the newest revisions. For example, the first time you run it, it dumps everything from the first revision to the last version (say revision 1000). Then, the next day it dumps revision 1001 to the last revision (say 1003), and the next day, revision 1004 to the last revision.

    To restore, you have to restore all the dumps, but the backup times are suppose to be shorter than doing a full dump each time.

    You can also do a hotcopy, but I don't find doing a hotcopy that much faster than doing a dump, and there could be issues if you have to move your repository to a different machine.

提交回复
热议问题