def checksum_all_files_on_server(dir_del_server_shortestpath, serverindex): """ @type dir_del_server_shortestpath: tuple @type serverindex: dict """ dirnames_content_hash = [(x["dirname_of_path"], x["content_hash"], x["doc"]["m_path_p64s"]) for x in serverindex["doclist"] if x["content_hash"]] all_hashes_on_server = [] for dirname_content_hash in dirnames_content_hash: if dir_del_server_shortestpath in dirname_content_hash[0]: all_hashes_on_server.append(dirname_content_hash[1]) all_hashes_on_server.sort() hashes_server = make_checksum_tuple(tuple(all_hashes_on_server)) return hashes_server
def checksum_all_files_in_dir(dirpath_make_server, localindex): """ @type dirpath_make_server: tuple @type localindex: dict """ all_files_in_local_dir = set() all_hashes_files_in_local_dir = [] all_files_in_local_dir_keys = [x for x in localindex["dirnames"] if dirpath_make_server in localindex["dirnames"][x]["dirname"]] for x in all_files_in_local_dir_keys: dirname = localindex["dirnames"][x]["dirname"] for f in localindex["dirnames"][x]["filenames"]: all_files_in_local_dir.add(os.path.join(dirname, f["name"])) for h in frozenset([make_cryptogit_filehash(x)["filehash"] for x in all_files_in_local_dir]): all_hashes_files_in_local_dir.append(h) all_hashes_files_in_local_dir.sort() hashes_local = make_checksum_tuple(tuple(all_hashes_files_in_local_dir)) return hashes_local