Thursday, February 26, 2009

Mercurial "case-folding collision" More Explanation on the fix

I've run into this error now a few times. What happens is you rename a file, changing only the case of one or more characters in the file name. This causes confusion. Now you can read here and here about the fix to this problem. I'm going to give a little more info on how to make this work, just because it might not be crystal clear reading those two sources.

You got this error either by checking out the project, or pulling changesets into your project and trying the 'update' command. So run these commands:

hg debugsetparents <revision>

The revision should be the one you are attempting to update to.

hg debugrebuildstate

now you want to remove all the files in error, you can use 'hg manifest tip' to check for the files in error. I've had more than one before after doing numerous renames that camel cased a number of files. use:

hg rm -A <filename>

to remove files, you can list multiple files to delete using spaces between each.

Once you've removed the files you should commit the changes:

hg ci -m "Fixed case problems"

Then do a clean check out the tip revision:

hg co -C tip

thats it, hope this helps to shed a little extra light on the process.

3 comments:

David Wolever said...

Awesome, thanks - this just saved me some headaches.

Aaron Curtis said...

Me too! Good work!

Anonymous said...

Thanks !