Mercurial > hgrepos > Python > apps > py-cutils
diff cutils/treesum.py @ 198:c1e875ba4bdc
Put the effective filesystem encoding into the treesum digest file using FSENCODING = <encoding>
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 16 Jan 2025 23:18:04 +0100 |
| parents | 48e2610978e5 |
| children | 22f92bf3572c |
line wrap: on
line diff
--- a/cutils/treesum.py Thu Jan 16 20:40:24 2025 +0100 +++ b/cutils/treesum.py Thu Jan 16 23:18:04 2025 +0100 @@ -352,6 +352,8 @@ self._outfp = outfp self._outfp.resetdigest() self._outfp.write(format_bsd_line("VERSION", "1", None, False)) + self._outfp.write(format_bsd_line( + "FSENCODING", util.n(walk.getfsencoding()), None, False)) self._outfp.flush() # @@ -628,7 +630,8 @@ if what == b"TIMESTAMP": assert filename is None return util.interpolate_bytes(b"TIMESTAMP = %d%s", value, ls) - if what in (b"ISOTIMESTAMP", b"FLAGS", b"VERSION", b"CRC32"): + if what in (b"FSENCODING", b"ISOTIMESTAMP", b"FLAGS", b"VERSION", + b"CRC32"): assert filename is None return util.interpolate_bytes(b"%s = %s%s", what, util.b(value), ls) assert filename is not None @@ -664,7 +667,7 @@ """ PATTERN0 = re.compile(br"\A[ \t]*\r?\n\Z") # empty lines - PATTERN1 = re.compile(br"\A(VERSION|FLAGS|TIMESTAMP|ISOTIMESTAMP|CRC32)[ \t]*=[ \t]*([^ \t]+)[ \t]*\r?\n\Z") # noqa: E501 line too long + 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)[ \t]*\((.*)\)[ \t]*\r?\n\Z") 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 @@ -880,7 +883,7 @@ root = record[1] elif record[0] == "COMMENT": comments.append(record[1]) - elif record[0] in ("TIMESTAMP", "ISOTIMESTAMP"): + elif record[0] in ("FSENCODING", "TIMESTAMP", "ISOTIMESTAMP"): pass elif record[0] == "CRC32": pass
