# HG changeset patch # User Arseniy Alekseyev # Date 1673026182 0 # Node ID 7623d79f872ccd342247e2f02bcc74e563457512 # Parent 15175774e1c5d1955592b96150846e348cf32ca2 pathutil: add the more efficient finddir iterator (to be used in subsequent commits) diff -r 15175774e1c5 -r 7623d79f872c mercurial/pathutil.py --- a/mercurial/pathutil.py Mon Jan 16 12:10:20 2023 +0000 +++ b/mercurial/pathutil.py Fri Jan 06 17:29:42 2023 +0000 @@ -314,6 +314,13 @@ yield b'' +def finddirs_rev_noroot(path: bytes) -> Iterator[bytes]: + pos = path.find(pycompat.ossep) + while pos != -1: + yield path[:pos] + pos = path.find(pycompat.ossep, pos + 1) + + class dirs: '''a multiset of directory names from a set of file paths'''