Resolving Mercurial Case-Folding Collision in Windows

后端 未结 9 1646
悲哀的现实
悲哀的现实 2020-12-09 08:15

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

相关标签:
9条回答
  • 2020-12-09 08:55

    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.

    0 讨论(0)
  • 2020-12-09 08:55

    I had this issue but using a *nix system was not an option. I was able to resolve it following these instructions.


    On Windows, it is currently (before Mercurial 1.1) possible to introduce case collisions in the repo that prevent you from checking out a repository.

    One way to repair such a repository is to check it out on a case-sensitive Unix system, remove the problematic file, and commit it again.

    If that's not possible, you can do the following:

    hg clone --noupdate repo repair
    cd repair
    hg debugsetparents <bad revision>
    hg debugrebuildstate
    

    At this point, Mercurial will think you have the bad revision checked out and all the files are missing (status '!'). To fix the repo, we simply have to do:

    hg remove --after <file causing the collision>
    

    Now hg status should show the troublesome file in state 'R' and all other files in state '!'. Now we can check in our fix:

    hg commit --message "fix case collision"
    

    To get all our files back, we just check out again:

    hg update tip
    

    Reference: https://www.mercurial-scm.org/pipermail/mercurial/2008-June/019921.html

    0 讨论(0)
  • 2020-12-09 08:56

    If you are using Bitbucket.org, you can browse the source on the problem branch, go to the file, click the drop down by edit, rename the file (or in our case rename the directory) commit those changes and pull.

    Thank you Bitbucket team!

    0 讨论(0)
提交回复
热议问题