diff --git a/bin/swh-hashdir b/bin/swh-hashdir index bb0f916..4a8861d 100755 --- a/bin/swh-hashdir +++ b/bin/swh-hashdir @@ -1,20 +1,25 @@ #!/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 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] = hashfile(path) + 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 + checksums)