Occasional case-folding error when trying to transplant or graft

Matt Mackall mpm at selenic.com
Wed Feb 1 12:04:35 CST 2012


On Tue, 2012-01-31 at 22:42 -0800, rupert.thurner wrote:
> On Jan 17, 7:10 pm, Matt Mackall <m... at selenic.com> wrote:
> > On Mon, 2012-01-16 at 15:46 -0800, JohnRenstrom wrote:
> > > We've been using Mercurial for several years at my company and every once in
> > > a while we will get that painful case-folding scenario; By using some custom
> > > hooks on push we have been able to catch these problems before they get
> > > pushed out to the main repository which has dramatically improved our down
> > > time.  Now it is just a local issue that one developer must resolve before
> > > his changeset can be pushed to the server.
> >
> > > We still bump into occasional case-folding issues with transplant/graft and
> > > today while I was examining one of these issues I may have stumbled onto a
> > > reason why they seem to come and go so randomly.
> >
> > > *My Theory:*
> > > AlthoughWindowsis a case-insensitive OS it does still preserve case; I
> > > noticed today that the same file had been added to two different branches:
> > >    Branch 1: 'Filename.txt'
> > >    Branch 2: 'FILENAME.TXT'    (AllUppercase)
> >
> > You probably have a tool in your toolchain that's helpfully uppercasing
> > filenames on write. We've seen this with various editors.
> >
> > Mercurial itself will studiously ignore such changes for -existing-
> > files. But for newly-added files, it will take the on-disk
> > capitalization. After that, merges with case collisions might have
> > "interesting" results onWindows.
> >
> > Recent Mercurial (as of 2.0.2 on Jan 1!) will refuse to merge branches
> > if there's a case conflict and you're using a case-insensitive
> > filesystem. This will probably "solve" your graft/transplant issue, but
> > you'll probably need to harmonize filenames across all your branches to
> > actually do any grafts.

> modern windows filesystem is case sensitive like most the other
> filesystems, as it stores the case of the filename. and it is
> perfectly fine to do:

Basically everyone (including Microsoft, in your cite) refers to that
behavior as "case-insensitive".

> $ move FILE file
> while mercurial gives an error on
> $ hg mv FILE file

Known issue with trivial workaround.

> such a windows filesystem move confuses mercurial (at least v-2.0)
> completely. if one changes the file and moves it, mercurial displays
> the file two times:
> $ hg st
> M FILE
> ? file

Works for me. Please file a bug with a test case if it's still present
in 2.0.2 or 2.1.

> besides some characters not allowed in filenames, windows only
> (default) restriction compared to POSIX is to prevent creating a file
> with the same name and different case.
>  cf
> http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx.

I suggest you read your cite more carefully, as it lists quite a number
of caveats. I've visited that page dozens of times and know of a bunch
of issues that aren't mentioned there (for instance, inconsistent
application of Unicode bestfit mappings).

The list of issues we've had with Windows filesystems is not exactly
short, even if you reduce case issues to a single bullet point.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list