rhg: implement checkexec to support weird filesystems
In particular, some of our repos are stored on a fileserver that simulates
POSIX permissions poorly, in such a way that prevents the removal
of execute permission.
This causes rhg show a spurious unclean status, even though python
hg reports the repo as clean.
We fix this by making rhg implement the ~same checkexec logic
that python hg does.
merge: cache the fs checks made during [_checkunknownfiles]
this ~halves the number of lstat calls made when updating
from rev(-1) to a revision with lots of files
merge: disable the whole filesystem access loop if [_realfs] is false
This makes it clearer that [auditeddir] is only relevant for
[_realfs] checkers, and makes the non-realfs checkers more performant.
merge: short-circuit the _checkfs loop upon getting ENOENT
This reduces the number of [lstat] calls when updating from rev(-1) to
a rev with lots of files by a factor of several: for path foo/bar/baz/quux.txt
without this patch we're lstatting:
foo
foo/bar
foo/bar/baz
foo/bar/baz/quux.txt
and with this patch:
foo
foo/bar/baz/quux.txt
pathauditor: no need to normcase the paths
The only thing normed paths are used is the key of the caching sets,
so the only change of behavior will be that the checks will be repeated
for paths that differ by case.
If anything, it seems correct for the check to be repeated, in case
that actually affects semantics, but the main reasoning is simplifying
the code and making it a bit faster.
It looks like the code originally comes from commit [
081e795c60e0]:
it looks like that commit tried to get rid of the existing norming,
but presumably did this overly cautiously, preserving it for the
cache keys, even though it was pointless even then.