SVN“格式错误的文件”损坏的存储库

发布于 2024-10-06 20:16:48 字数 133 浏览 0 评论 0原文

我今天遇到了一个损坏的存储库的问题。

svn log 给了我“格式错误的文件”错误,即使 svnadmin verify 说一切正常。

当您的源历史记录消失时,这总是很糟糕,所以我也会发布一个答案,以防它对某人有帮助。

I had 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我们的影子 2024-10-13 20:16:48

备份您的存储库!

  • 运行“svnadmin dump REPOSPATH > nul”

注意它能够转储的最后一个版本(例如99),下一个版本有错误(例如100)。

  • 从 REPOSPATH\db\revprops 打开错误的修订版 props。

如果它包含垃圾或 NUL,您可以修复它:

  • 将以前的道具 (99) 复制到错误的道具 (100) 上
  • ,打开更正的道具,将日期设置为合理的值(除非您知道文件格式,否则不要编辑其他任何内容) )

再次运行“svnadmin dump REPOSPATH > nul” - 它应该完成且没有错误

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

皓月长歌 2024-10-13 20:16:48

@laktak 的解决方案在大多数情况下在 props 损坏时有效,但在 @jgifford25 指出的实际 rev 文件时无效。

理想的解决方案是:

  1. 按照 @laktak 的建议识别损坏的更改,假设 100
  2. 从一开始就将转储到最后一个有效版本作为备份,或者如果您有备份直到有效修订版,则跳过此操作。
    svnadmin dump /path/to/currentrepo -r 0:99 --incremental > svnbackuptillvalid
  1. 对修订版 100 之后提交的版本进行第二次备份,直到 head(仅当有时,如果您确定损坏后没有提交,请跳过此操作)。
   svnadmin dump /path/to/currentrepo -r 101:HEAD --incremental > svnbackupafterinvalid
  1. 现在创建一个新存储库
    svnadmin create /path/to/newrepo
  1. 将有效修订备份恢复到新存储库
    svnadmin load /path/to/newrepo < svnbackuptillvalid

与团队共享新存储库 URL 或删除现有存储库并使用相同的路径。

此外,您可以添加在无效修订后提交的有效变更集。

    svnadmin load /path/to/newrepo < svnbackupafterinvalid

@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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文