Mercurial > hgrepos > Python > apps > py-cutils
comparison cutils/util/walk.py @ 177:089c40240061
Add an alternate implementation for generating directory tree digests:
- Do not use something like os.walk() but use os.scandir() directly.
- Recursively generate the subdirectory digests only when needed and in
the right order.
This fixes that the order of subdirectories in the output did not
match the application order of its directory digests.
The new implementation also should make filtering (that will be
implemented later) easier.
NOTE: The tree digests of the old and the new implementation are identical.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sat, 11 Jan 2025 17:41:28 +0100 |
| parents | 506d895a8500 |
| children | dac26a2d9de5 |
comparison
equal
deleted
inserted
replaced
| 176:7f5d05a625fd | 177:089c40240061 |
|---|---|
| 5 # :- | 5 # :- |
| 6 r"""Utility sub-module to implement a heavily customized :func:`os.walk`. | 6 r"""Utility sub-module to implement a heavily customized :func:`os.walk`. |
| 7 | 7 |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 __all__ = ["walk"] | 10 __all__ = ["walk", |
| 11 "ScanDir"] | |
| 11 | 12 |
| 12 | 13 |
| 13 import os | 14 import os |
| 14 try: | 15 try: |
| 15 from os import scandir | 16 from os import scandir |
