pathutil: use `finddirs_rev_noroot` instead of `parts`
The benefit this brings is very tiny, if it's even there,
since we still didn't get rid of the [parts] computation.
It probably won't be worth it without the subsequent patch
that adds one more use of [finddirs_rev_noroot]
--- a/mercurial/pathutil.py Fri Jan 06 17:29:42 2023 +0000
+++ b/mercurial/pathutil.py Fri Jan 06 16:42:24 2023 +0000
@@ -107,14 +107,12 @@
)
if self._realfs:
- parts.pop()
# It's important that we check the path parts starting from the root.
# We don't want to add "foo/bar/baz" to auditeddir before checking if
# there's a "foo/.hg" directory. This also means we won't accidentally
# traverse a symlink into some other filesystem (which is potentially
# expensive to access).
- for i in range(len(parts)):
- prefix = pycompat.ossep.join(parts[: i + 1])
+ for prefix in finddirs_rev_noroot(path):
if prefix in self.auditeddir:
res = self.auditeddir[prefix]
else: