开发者

SVN "Malformed file" Corrupt Repository

I 开发者_StackOverflowhad a problem with a corrupt repository today.

svn log gave me "Malformed file" errors even though svnadmin verify said everything was OK.

It's always bad when your source history is gone so I'll also post an answer in case it helps someone.


Backup your repository!

  • run "svnadmin dump REPOSPATH > nul"

Note the last revision it was able to dump (eg. 99), the next one has the error (e.g. 100).

  • Open the bad revision props from REPOSPATH\db\revprops.

If it contains garbage or NULs you can fix it:

  • copy the previous props (99) over the bad one (100)
  • open the corrected props, set the date to a resonable value (don't edit anything else unless you know the file format)

run "svnadmin dump REPOSPATH > nul" again - it should finish without errors


@laktak's solution work in most cases when props are corrupted, but not when the actual rev file as pointed by @jgifford25.

An ideal solution would be to:

  1. Identify corrupt changes as suggested @laktak, let's say 100
  2. Take the dump till only last valid version from the start as a backup, or skip this if you have backup till valid revision.
    svnadmin dump /path/to/currentrepo -r 0:99 --incremental > svnbackuptillvalid
  1. Take the second backup for version committed after revision 100, till head (only if any, skip this if you are sure there are no commits after corrupted).
   svnadmin dump /path/to/currentrepo -r 101:HEAD --incremental > svnbackupafterinvalid
  1. Now create a new repository
    svnadmin create /path/to/newrepo
  1. Restore the valid revision backup to the new repo
    svnadmin load /path/to/newrepo < svnbackuptillvalid

Share the new Repo URL with a team or delete existing repo and use the same path.

Additionally, you can add valid changesets committed after Invalid revision.

    svnadmin load /path/to/newrepo < svnbackupafterinvalid
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜