[PATCH 1 of 8] Add a new function, fspath

Matt Mackall mpm at selenic.com
Thu May 1 13:34:13 CDT 2008

On Wed, 2008-04-30 at 18:37 +0100, Paul Moore wrote:
> # HG changeset patch
> # User "Paul Moore <p.f.moore at gmail.com>"
> # Date 1209573914 -3600
> # Node ID 4c332d2df388086257be74380d53701631fd3a2e
> # Parent  7758fc67c39fd22b1025faa02a69b49acfdb557c
> Add a new function, fspath
> 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 a default value).

First, I haven't yet spotted any users of the optional args. We probably
shouldn't have any if they're not used. And if they're always used, they
shouldn't be optional.

Second, this function could be tons faster if it instead took a list of
files. Then it could use an internal cache of filename components to
avoid repeated directory scans.

As we primarily will be using this on filenames supplied as a list on
the command line, this should work out nicely.

Alternately, we could add a cache dict argument to reuse a cache across

Mathematics is the supreme nostalgia of our time.

More information about the Mercurial-devel mailing list