# HG changeset patch # User Franz Glasner # Date 1735855400 -3600 # Node ID d2c303695fb8518d24c8804d6470cef19be79401 # Parent cf4fb9a33f946521df218bd847e4c7aeae9df675 Put a file version number into the output. While there change the output order: ROOT() not directly before the digests. diff -r cf4fb9a33f94 -r d2c303695fb8 cutils/treesum.py --- a/cutils/treesum.py Thu Jan 02 21:03:43 2025 +0100 +++ b/cutils/treesum.py Thu Jan 02 23:03:20 2025 +0100 @@ -142,7 +142,7 @@ :param outfp: a *binary* file with a "write()" and a "flush()" method """ - outfp.write(format_bsd_line("ROOT", None, root, False)) + outfp.write(format_bsd_line("VERSION", "1", None, False)) outfp.flush() # Note given non-default flags that are relevant for directory traversal @@ -153,12 +153,17 @@ flags.append("follow-directory-symlinks") if flags: outfp.write(format_bsd_line("FLAGS", ",".join(flags), None, False)) + outfp.flush() # Write execution timestamps in POSIX epoch and ISO format ts = time.time() outfp.write(format_bsd_line("TIMESTAMP", ts, None, False)) ts = (datetime.datetime.utcfromtimestamp(ts)).isoformat("T") outfp.write(format_bsd_line("ISOTIMESTAMP", ts, None, False)) + outfp.flush() + + outfp.write(format_bsd_line("ROOT", None, root, False)) + outfp.flush() dir_digests = {} @@ -227,7 +232,7 @@ if digestname == b"TIMESTAMP": assert filename is None return b"TIMESTAMP = %d%s" % (value, ls) - if digestname in (b"ISOTIMESTAMP", b"FLAGS"): + if digestname in (b"ISOTIMESTAMP", b"FLAGS", b"VERSION"): assert filename is None if not isinstance(value, bytes): value = value.encode("ascii")