diff cutils/treesum.py @ 129:bdd8ea43074b

Output FLAGS as line "FLAGS = ..." instead of "FLAGS (...)"
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 02 Jan 2025 18:36:40 +0100
parents 7c646921a479
children d5621028ce39
line wrap: on
line diff
--- a/cutils/treesum.py	Thu Jan 02 18:23:10 2025 +0100
+++ b/cutils/treesum.py	Thu Jan 02 18:36:40 2025 +0100
@@ -136,9 +136,9 @@
     # Note given non-default flags that are relevant for directory traversal
     flags = []
     if handle_root_logical:
-        flags.append(b"logical")
+        flags.append("logical")
     if flags:
-        outfp.write(format_bsd_line("FLAGS", None, b",".join(flags), False))
+        outfp.write(format_bsd_line("FLAGS", ",".join(flags), None, False))
 
     # Write execution timestamps in POSIX epoch and ISO format
     ts = time.time()
@@ -207,11 +207,14 @@
     if not isinstance(digestname, bytes):
         digestname = digestname.encode("ascii")
     if digestname == b"TIMESTAMP":
+        assert filename is None
         return b"TIMESTAMP = %d%s" % (value, ls)
-    if digestname == b"ISOTIMESTAMP":
+    if digestname in (b"ISOTIMESTAMP", b"FLAGS"):
+        assert filename is None
         if not isinstance(value, bytes):
             value = value.encode("ascii")
-        return b"ISOTIMESTAMP = %s%s" % (value, ls)
+        return b"%s = %s%s" % (digestname, value, ls)
+    assert filename is not None
     if not isinstance(filename, bytes):
         filename = util.fsencode(filename)
     if value is None: