Search code examples
mercurial

Resolving Mercurial Case-Folding Collision in Windows


I've seen the other Mercurial case-folding Answers on StackOverflow - they say that if you have access to a case sensitive file system like unix then check out there and it should fix it. Problem is, I don't have access to a unix box, I'm a windows developer developing a windows application.

How do I fix this without a Unix box?


Solution

  • There is a filesystem help topic being worked on that will be included in the next version of Mercurial:

    https://www.mercurial-scm.org/pipermail/mercurial-devel/2012-April/039522.html

    Renaming colliding files

    On case-insensitive filesystems, updating to revisions which have files with case collisions will abort, even with --check or --clean.

    To repair such revisions, you should give new names to one or both of the colliding files on a case-sensitive filesystem, and commit them to create new collision safe revision.

    .. note:: If you want to (or need to) browse or repair such revisions on case-insensitive filesystems, please see 'Updating manually' section.

    If :hg:merge is aborted, but :hg:update --check to each revisions successes, collision occurs between revision to be merged.

    In this case, files in one of them or both should be renamed to avoid collision before merging.

    With recent Mercurial, you can change case of filename safely in steps below, even on case-insensitive filesystems::

    $ hg rename a.txt tmp
    $ hg rename tmp A.TXT
    

    Updating manually

    If you want to (or need to) update working directory by the revision causing case-folding collision on case-insensitive filesystems, to rename colliding files or browsing contents at such revision for example, please see the Wiki page below::

    https://www.mercurial-scm.org/wiki/ManualCheckout

    This is NOT recommended for non expert Mercurial users.

    Another similar manual method is described here:

    https://www.mercurial-scm.org/wiki/FixingCaseCollisions

    This also dives rather deep into Mercurial internals though, so you should avoid it unless as a last resort.