[PATCH 4 of 8] Fix for issue 1092 (hg add gives wrong result when filename case doesn't match)

Paul Moore p.f.moore at gmail.com
Fri May 2 13:34:06 CDT 2008


2008/5/2 Patrick Mézard <pmezard at gmail.com>:
>  This is related to your remark about paths comparison, here you assume the dirstate is made of fspath entries.
> This is not enforced by current code. For instance dirstate.normal(fn) just stats and add the name as such in the
> mapping. I don't have a solution right now, just mentioning it.
>
>  This issue can probably arise through cmdline -> status -> dirstate.normal() calls because localrepo.status() does
> not return fspath.

Sigh. That doesn't surprise me, I'm afraid. I tried to track the
various path styles, to ensure that I respected the constraints of the
current code, but it simply isn't consistent, even now. It works,
though, so that's the criterion I used, as well - if it passes the
test suite, and fixes the issue that's broken, then accept it at that
point.

I'd much rather things were consistent and the guarantees documented,
but there's no way I felt competent to do that much refactoring.

As a trivial example, localrepo.rjoin joins self.root and
util.pconvert(f) - but pconvert switches all path separators to be
'/', so we have an inconsistent set of path separators in the result.
Luckily, this is OK as the only supported platform where os.sep isn't
'/' is Windows, and Windows accepts / and \ interchangeably as path
separators. That's the point I gave up, although just now I did a grep
to find that repo.rjoin is never actually used!

Maybe my next task will be to find and document all of the API
functions, and work out which are actually used. That should keep me
out of mischief for a while :-)

Paul



More information about the Mercurial-devel mailing list