Call us Toll-Free:
1-800-218-1525
Live ChatEmail us

 Sponsors

How to fix Mercurial Corrupt Repository

Liviu Olos, 01-07-2010
If you're using Mercurial HG and keep running into the "premature EOF reading chunk" error, there's hope. As part of this post, I will walk you through the process of repairing a damaged repository where HG .i files are corrupt and no one can successfully "Pull Changes".

Step 1: Connect to your HG server, cd to the repository folder and run
hg verify

If you get something like

Quote:
error_file_name.extension@553: unpacking 646ac1c08e97: ./../Objects/stringobject.c:4124: bad argument to internal function
10662 files, 567 changesets, 11475 total revisions
1 integrity errors encountered!

Voila, you're dealing with HG index corruption.

Step 2: Backup the file path_to_project/.hg/store/data/error_file_name.extension.i backup/error_file_name.extension.i

Step 3: In the path_to_project/ folder create a new empty file
echo "" >> new_file.extension

Step 4:
hg add new_file.extension

Step 5:
hg commit

You might need to do hg commit -u hg_user_name

Step 6: Go to path_to_project/.hg/store/data/ and
cp new_file.extension.i error_file_name.extension.i

This will replace the current file

Step 7: Pull the files from your local HG client and you should be all set!

-

Tip: To avoid unnecessary merges, always "Pull Changes" - "Commit" and "Push" as close to each other as possible.
Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

 Comments
Post your comments












Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.



About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions