Source Control

Fix Mercurial Case Folding Collisions

Posted by Dallas on December 23, 2008
Mercurial / 3 Comments

I switched awhile ago from SVN to Mercurial and I am loving it.

One pain is if you create a file, check it in, and then later change the case (from ‘a’ to ‘A’ for example) and check that in, when you try and checkout the latest version you will get the error:

“abort: case-folding collision between myFile.m and MyFile.m”

This is one error/abort that doesn’t tell you how to fix it.

After some research I have found the following to work.

Note: Notes are in Italic. Items you should replace with your own info are in Italic and Bold.

  1. hg clone https://username@myrepo-location.com/hg/index.cgi/MyProgram
  2. cd MyProgram
  3. hg debugsetparents 11 (the revision number you need to fix)
  4. hg debugrebuildstate
  5. hg rm -A MyFile.m (mark missing file as deleted)
  6. hg ci -m “fix case collision”
  7. hg manifest tip   (confirm that the collision is gone)
  8. cd ..
  9. rm -rf MyProgram
  10. hg clone https://username@myrepo-location.com/hg/index.cgi/MyProgram

You should now have a clean clone of the repo.

Note: It is possible that after doing the above you will be presented with the same error, but on a different file (if there are multiple conflicts). If that happens just do the above again for each conflict.


Tags: ,