Looking at case insensitivity - question

Paul Moore p.f.moore at gmail.com
Sun Apr 13 20:51:04 UTC 2008


I'm looking at how Mercurial handles case-insensitivity issues, with
the hope of fixing some of the bugs in this area. However, one thing
I'm finding is that I need to identify the actual filename in the
filesystem, given a name which matches it, but may differ in case.

I can write a function to do this, but I think it needs to be
expensive (walk up the filename, doing os.listdir at each level, to
get the correct case for the name). So I have three questions:

1. Is there an easier way of doing this which I may have missed?
2. Would it be acceptable to do this sort of conversion (for example,
it's needed in dirstate.py, in the "yield 'f'" case of statwalk)? (I'm
more thinking of the performance cost - if it's unacceptable because
it doesn't work, I hope I'll find that out myself :-))
3. Is there a way I can check for a case-sensitive filesystem (I can't
just check the system type - think of Windows filesystems mounted on
Unix over Samba) to avoid the cost in this case?

Thanks,
Paul.

PS A final question - would this be better on the -devel list?



More information about the Mercurial mailing list