[PATCH 1 of 3] Add a new function, filesystem_case

Matt Mackall mpm at selenic.com
Wed Apr 23 16:29:41 CDT 2008


On Tue, 2008-04-22 at 23:10 +0100, Paul Moore wrote:
> # HG changeset patch
> # User "Paul Moore <p.f.moore at gmail.com>"
> # Date 1208894004 -3600
> # Node ID 47aabfeb37f4a12d015b809afef81cb817e18972
> # Parent  90becd2b697eb345328dabb08e23262335bf9ff2
> Add a new function, filesystem_case
> 
> The function, given a filename and an (optional) root, returns the filename
> modified to use the case actually stored in the filesystem (if the file does
> not exist, return the name unchanged).
> 
> An immplementation for Windows (case insensitive) and a no-op implementation
> for Unix is given. Unix can potentially have a case insensitive filesystem,
> but this implementation doesn't consider that. We also don't consider fancy
> stuff like Mac OS X normalisation forms. Suitable implementations for these
> can be added later.

First off, a style note: we don't use underbars. I don't ever want to
remember whether the function is filesystemcase, filesystem_case,
filesystemCase, or FilesystemCase. I always want things in the first
style, whether it be a function, class, module, whatever.

Second, this problem isn't at all localized to Windows, so localizing
the solution to Windows is getting off on the wrong foot. Just define
the function everywhere and then use checkfolding to decide whether or
not to /use/ it.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list