9

I have a project versioned by Mercurial. Once, I ran a command such as...

$ find . -type f | xargs sed -i.bkp 's/my_func/another_func/'

...in this project. Then Mercurial just stopped to work on it:

$ hg status
abort: index 00changelog.i is corrupted!

The file 00changelog.i did not contain the replaced string, and even if I move 00changelog.i.bkp to 00changelog.i the problem persisted. hg verify didn't help either:

$ hg verify
abort: index 00changelog.i is corrupted!

I solved this problem by cloning the project from my remote repository in another directory and then copying .hg from my cloned repository to the corrupted one. However, I wonder: is there another more practical way of solving it? BTW, why does this problem happens if the "corrupted" file is not even altered?

2 Answers 2

7

Note that there are two 00changelog.i files:

  • one in .hg/00changelog.i which is a small backwards-compatibility placeholder for ancient versions
  • another (the one you damaged) in .hg/store/00changelog.i
3
  • You are right! I did not know it. However, it does not solve the question: I moved the .hg/store/00changelog.i.bkp to .hg/store/00changelog.i and the problem persists.
    – brandizzi
    Oct 7, 2011 at 20:21
  • 1
    Did you restore the corresponding .d file too? If you did multiple seds and thereby overwrote your backups, you'll be out of luck. Otherwise, it's not magic: put the bits that were there before back and it will work again.
    – mpm
    Oct 7, 2011 at 21:07
  • Well, I did not find any .d file, but then I ran for f in $(find .hg -name '*.bkp') ; do mv $f ${f/.bkp/} ; done and could make the repository work again.
    – brandizzi
    Oct 7, 2011 at 21:18
-2

I'd use convert to re-generate the repo or transplant to move the patches to the new one. Good luck.

1
  • Interesting... Are you talking about the convert extension? How could I use it to regenerate the repository?
    – brandizzi
    Oct 7, 2011 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.