Search code examples
mercurialtortoisehg

Mercurial corruption? "No such file or directory"


I'm currently running Mercurial 6.4.2. I've been using TortoiseHg for a long time and just started running into this recurring issue where if I update some files in specific folders, or if I delete those folders and then try to add them back, I get this error:

enter image description here

These are binary files. hg verify turned up a few issues with the repo, so I concluded that some of the history for these files had become irredeemably corrupted. I then tried a full hg convert --config convert.hg.ignoreerrors=True sqs sqsfix as mentioned on the repository corruption page. I went through each of the 288 corrupted files and removed the .i files as suggested on that page until the conversion finished. hg verify reports no issues for the new converted repo.

Then I copied the most up to date versions of the .dwg files whose history had been corrupted to the converted repo with the hopes that I could just commit those and then resume development from there. Nope, I get the exact same error that I started with:

enter image description here

I have no idea what to do now or what the issue might be, and Google doesn't turn up anything for this issue.


Solution

  • It turns out this is a recently discovered issue with Mercurial itself when the file paths get too long, it messes up the backup files that you see in the error message. This is probably what caused the original corruption, it just proceeded silently prior to Mercurial 6.x series. Starting sometime in the 6.x series it started actively reporting the issue which is when we started seeing these errors.

    I've confirmed that Mercurial 6.5 fixes the issue completely.