commit 91b0caf89ffbcd64c670ddc387741fe9e8901b5e from: Stefan Sperling date: Wed Sep 11 11:18:47 2024 UTC syntactic changes made by black and isort commit - 1abdec0ef115d8c29968fc2eeb22936bff743295 commit + 91b0caf89ffbcd64c670ddc387741fe9e8901b5e blob - bad93b27fbcbfcfe219bca5547cabae56b6d75e1 blob + ffda1054c499b061edb13fc90d47c3550e64e74b --- swh/loader/git/loader.py +++ swh/loader/git/loader.py @@ -32,8 +32,8 @@ import dulwich.client from dulwich.object_store import ObjectStoreGraphWalker from dulwich.objects import Blob, Commit, ShaFile, Tag, Tree from dulwich.pack import Pack, PackData, PackInflater, load_pack_index -import urllib3.util from igraph import Graph +import urllib3.util from swh.core.statsd import Statsd from swh.loader.exception import NotFound @@ -554,7 +554,7 @@ class GitLoader(BaseGitLoader): content_hashes = [] missing_subtrees = [] missing_contents = [] - for (name, mode, sha) in tree.iteritems(): + for name, mode, sha in tree.iteritems(): if mode & stat.S_IFDIR: subtree_hashes.append(hashutil.bytehex_to_hash(sha)) logging.debug(f"subtree: {name} {sha}") @@ -807,7 +807,7 @@ class GitLoader(BaseGitLoader): logger.debug(f" pack is missing: {tree_hex}") continue logger.debug(f"Entries of {tree}:") - for (name, mode, entry_hex) in tree.iteritems(): + for name, mode, entry_hex in tree.iteritems(): logger.debug(f" {name} {mode} {entry_hex}") if mode & submodule_mode == submodule_mode: continue # ignore submodules @@ -952,7 +952,7 @@ class GitLoader(BaseGitLoader): for t in tree_vertices: tree_hash = t["name"] have_dep = False - for (dep_hash, dep_type) in get_dependencies(tree_hash): + for dep_hash, dep_type in get_dependencies(tree_hash): have_dep = True if dep_type == GitObjectType.BLOB and dep_hash in missing_contents: self.log.debug( @@ -991,7 +991,7 @@ class GitLoader(BaseGitLoader): ) for c in commit_vertices: commit_hash = c["name"] - for (dep_hash, dep_type) in get_dependencies(commit_hash): + for dep_hash, dep_type in get_dependencies(commit_hash): if dep_hash in missing_contents or dep_hash in missing_directories: self.log.debug( f"commit {hashutil.hash_to_bytehex(commit_hash)!r} depends on " @@ -1035,7 +1035,7 @@ class GitLoader(BaseGitLoader): ) for t in tag_vertices: tag_hash = t["name"] - for (dep_hash, dep_type) in get_dependencies(tag_hash): + for dep_hash, dep_type in get_dependencies(tag_hash): if ( dep_hash in missing_revisions or dep_hash in missing_directories @@ -1089,7 +1089,7 @@ class GitLoader(BaseGitLoader): storage_summary.update(self.flush()) self.loaded_snapshot_id = snapshot.id - for (object_type, total) in self.counts.items(): + for object_type, total in self.counts.items(): filtered = total - storage_summary[f"{object_type}:add"] assert 0 <= filtered <= total, (filtered, total) blob - e660f4d3fa82c59ca165f39717f5812f43e53dba blob + dd48ccc53f93d5e21a89c73d99bd1ec8caf4810e --- swh/loader/git/tests/test_loader.py +++ swh/loader/git/tests/test_loader.py @@ -1147,9 +1147,11 @@ def test_loader_too_large_pack_file_for_github_origin( ) def test_split_lines_and_remainder(input, output): assert split_lines_and_remainder(input) == output + TEST_DATA = os.path.join(os.path.dirname(__file__), "data") + def test_loader_load_in_topological_order( swh_storage, datadir, tmp_path, mocker, sentry_events ):