# HG changeset patch # User Franz Glasner # Date 1741598757 -3600 # Node ID fc1b940bd4a6c82c16ce500e581ff57b1e2da8a4 # Parent 3f1f1c2e9e5f80d51b62f14068cfd4cbce7ffc4c treesum: when accepting treesum digest files put a line with its filename into the output diff -r 3f1f1c2e9e5f -r fc1b940bd4a6 cutils/treesum.py --- a/cutils/treesum.py Mon Mar 10 10:25:20 2025 +0100 +++ b/cutils/treesum.py Mon Mar 10 10:25:57 2025 +0100 @@ -804,6 +804,7 @@ size=sz) return (errno.ESRCH, None, None, None) # We got all required infos without errors + self._writer.write_accept_treesum_file(fpath) if self._size_only: self._writer.write_size(opath, collector.size) else: @@ -1396,6 +1397,12 @@ self.write(util.b(str(sz))) self.writeln(b"") + def write_accept_treesum_file(self, filename): + assert isinstance(filename, bytes) + self.write(b"ACCEPT-TREESUM (") + self.write(filename) + self.writeln(b")") + def write_file_digest(self, algorithm, filename, digest, use_base64=False, size=None): assert isinstance(filename, bytes) @@ -1457,7 +1464,7 @@ PATTERN0 = re.compile(br"\A[ \t]*\r?\n\Z") # empty lines PATTERN1 = re.compile(br"\A(VERSION|FSENCODING|FLAGS|TIMESTAMP|ISOTIMESTAMP|CRC32)[ \t]*=[ \t]*([^ \t]+)[ \t]*\r?\n\Z") # noqa: E501 line too long - PATTERN2 = re.compile(br"\A(ROOT|COMMENT|ERROR|GENERATOR|FNMATCH)[ \t]*\((.*)\)[ \t]*\r?\n\Z") # noqa: E501 line too long + PATTERN2 = re.compile(br"\A(ROOT|COMMENT|ERROR|GENERATOR|FNMATCH|ACCEPT-TREESUM)[ \t]*\((.*)\)[ \t]*\r?\n\Z") # noqa: E501 line too long PATTERN3 = re.compile(br"\ASIZE[ \t]*\((.*)\)([ \t]*=[ \t]*(\d+))?[ \t]*\r?\n\Z") # noqa: E501 line too long PATTERN4 = re.compile(br"\A([A-Za-z0-9_-]+)[ \t]*\((.*)\)([ \t]*=[ \t]*([A-Za-z0-9=+/]+)?(,(\d+)?)?)?[ \t]*\r?\n\Z") # noqa: E501 line too long @@ -1589,6 +1596,8 @@ return (util.n(mo.group(1)), util.u(mo.group(2), "utf-8")) elif mo.group(1) == b"ROOT": return ("ROOT", mo.group(2)) + elif mo.group(1) == b"ACCEPT-TREESUM": + return ("ACCEPT-TREESUM", mo.group(2)) assert False, line else: mo = self.PATTERN3.search(line) @@ -1710,6 +1719,8 @@ fnmatch_filters.append(record[1]) elif record[0] in ("TIMESTAMP", "ISOTIMESTAMP"): pass + elif record[0] == "ACCEPT-TREESUM": + pass elif record[0] == "CRC32": pass # in_block = False