Mercurial > hgrepos > Python > apps > py-cutils
changeset 306:ebddfdbc3f7a
treesum: use a callback to print parsed .treesum output file infos
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 05 Mar 2025 14:05:38 +0100 |
| parents | 6c212e407524 |
| children | 64df94bf4659 |
| files | cutils/treesum.py |
| diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/cutils/treesum.py Wed Mar 05 13:54:55 2025 +0100 +++ b/cutils/treesum.py Wed Mar 05 14:05:38 2025 +0100 @@ -1519,10 +1519,14 @@ def print_treesum_digestfile_infos(opts): - print_infos_for_digestfile(opts.digest_files, opts.print_only_last_block) + get_infos_from_digestfile( + opts.digest_files, + print_block_data, + opts.print_only_last_block) -def print_infos_for_digestfile(digest_files, print_only_last_block=True): +def get_infos_from_digestfile(digest_files, block_handler, + only_last_block=True): for fn in digest_files: if fn == "-": if util.PY2: @@ -1580,8 +1584,8 @@ algorithm = record[0] digest = record[2] size = record[3] - if not print_only_last_block: - print_block_data( + if not only_last_block: + block_handler( block_no, root, generator, fsencoding, flags, fnmatch_filters, @@ -1591,10 +1595,10 @@ errors = set() comments = [] in_block = False - if print_only_last_block: + if only_last_block: if not in_block: if digest is not None or size is not None: - print_block_data( + block_handler( block_no, root, generator, fsencoding, flags, fnmatch_filters, comments, errors, algorithm, digest, size)
