Looking at case insensitivity - question

Gregory Collins greg at maptuit.com
Fri Apr 18 15:07:11 UTC 2008


JASON STEWART <jasoncstewart at verizon.net> writes:

> I imported a file with an uppercase name. I want to rename it to a
> lowercase name. Mercurial refuses to allow the rename so I thought I'd
> use the shell ren command and then use the handy "--after" flag to
> tell it that it was already done. You can see that mercurial tries to
> mark the uppercase one as removed but deletes the lowercase one while
> marking it for deletion. Now I don't have a copy of the file at all. I
> ran hg up and now my changes are lost, I have the uppercase one but
> not the lowercase one and mercurial thinks there are no changes to the
> repository. This is insane.

This is definitely a bug, but there's a workaround; to rename "FOO.txt"
to "foo.txt" you have to do:

  $ hg mv FOO.txt bar
  $ hg mv bar foo.txt

At our shop, sometimes someone will manage to accidentally commit a
rename changeset (e.g. Lib/foo/bar.c -> lib/foo/bar.c) that results in a
case-folding conflict. It usually isn't detected until someone tries to
do a merge, in which case mercurial fails with an error about
case-folding. 

We're not sure how or why it happens, although I have a hunch that
Visual Studio's editor is to blame --- I've seen it smash filenames to
lowercase before.

G.



More information about the Mercurial mailing list