Mercurial > hgrepos > Python > apps > py-cutils
diff cutils/treesum.py @ 269:fc002983253c
treesum: also return the algorithm used by directory digests.
This is a preparation for re-using it from existing treesum files.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Tue, 18 Feb 2025 13:10:05 +0100 |
| parents | 8aadffaaad5f |
| children | 42f4ca423ab3 |
line wrap: on
line diff
--- a/cutils/treesum.py Tue Feb 18 12:56:49 2025 +0100 +++ b/cutils/treesum.py Tue Feb 18 13:10:05 2025 +0100 @@ -609,7 +609,7 @@ else: self._writer.write_file_digest(self._algorithm[1], opath, None) self._writer.flush() - return (None, None) + return (None, None, None) if self._utf8_mode: fsobjects.sort(key=walk.WalkDirEntry.sort_key_u8) else: @@ -694,10 +694,11 @@ # # Get subdir data from recursing into it - sub_dir_dgst, sub_dir_size = self._generate( + sub_dir_algo, sub_dir_dgst, sub_dir_size = self._generate( root, top + (fso.name, )) - if sub_dir_dgst is None or sub_dir_size is None: + if (sub_dir_algo is None or sub_dir_dgst is None + or sub_dir_size is None): # # This should not happen: # - top-level directories are handled above @@ -921,7 +922,7 @@ self._algorithm[1], opath, dir_dgst.digest(), use_base64=self._use_base64, size=sz) self._writer.flush() - return (dir_dgst.digest(), dir_size) + return (self._algorithm[1], dir_dgst.digest(), dir_size) def join_output_path(top, name):
