diff --git a/bin/swh-hashdir b/bin/swh-hashdir index 24373b2..f3f30cc 100755 --- a/bin/swh-hashdir +++ b/bin/swh-hashdir @@ -1,28 +1,28 @@ #!/usr/bin/python3 # Copyright (C) 2015 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information import os import sys from swh.core.hashutil import hashfile, hash_to_hex if __name__ == '__main__': dirname = sys.argv[1] hashes = {} for root, _dirs, files in os.walk(dirname): for name in files: path = os.path.join(root, name) hashes[path] = { algo: hash_to_hex(checksum) for algo, checksum in hashfile(path).items() } hashes[path]['length'] = os.path.getsize(path) for (path, checksums) in hashes.items(): - print("%(sha1)s\t%(sha1_git)s\t%(sha256)s\t%(length)d\tvisible" % # NOQA + print("\\\\x%(sha1)s\t\\\\x%(sha1_git)s\t\\\\x%(sha256)s\t%(length)d\tvisible" % # NOQA checksums)