How do I fix a repository with one broken revision?

后端 未结 1 467
忘掉有多难
忘掉有多难 2021-02-01 14:28

My home server had a hard drive failure.

Once I realized the disk was going, I logged in and did a straight copy of my repository, which contains multiple projects.

1条回答
  •  无人及你
    2021-02-01 15:02

    I solved it.

    The solution was (of course) obvious, once I realized it.

    I had this:

    • master/: A copy of a broken repository, featuring revision 0..947, with revision 823's files physically missing.
    • repos/: A repository loaded from a backup (dump file), covering revision 0..910.

    The solution was simply to dump from master/, from revision 911 and onwards. This was possible without any errors, which I take it means that none of the revisions in the range 911..947 directly depended on the state in revision 823, or something:

    $ svnadmin dump --incremental -r 911:947 master/ > tail.txt
    * Dumped revision 911.
    * Dumped revision 912.
    * Dumped revision 913.
    [...]
    * Dumped revision 947.
    

    Anyway, then just apply the dump to the repository coming from the backup:

    $ cat tail.txt | svnadmin load repos/
    [lots of commits]
    

    And now I have the full history restored, no problems:

    $ svnadmin verify repos/
    * Verified revision 0.
    * Verified revision 1.
    * Verified revision 2.
    [...]
    * Verified revision 945.
    * Verified revision 946.
    * Verified revision 947.
    

    Yay!

    0 讨论(0)
提交回复
热议问题