self = <swh.vault.tests.test_cookers.TestSnapshotCooker object at 0x7f04f93ed4a8>
git_loader = <function git_loader.<locals>._create_loader at 0x7f04f94a3bf8>
cook_extract_snapshot = <function cook_extract_snapshot_git_bare at 0x7f04fce637b8>
def test_snapshot_two_heads(self, git_loader, cook_extract_snapshot):
(loader, main_rev_id) = self.load_repo_two_heads(git_loader)
snp_id = loader.loaded_snapshot_id
swhid = CoreSWHID(object_type=ObjectType.SNAPSHOT, object_id=snp_id)
> with cook_extract_snapshot(loader.storage, swhid) as (ert, p):
.tox/py3/lib/python3.7/site-packages/swh/vault/tests/test_cookers.py:1047:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/contextlib.py:112: in __enter__
return next(self.gen)
.tox/py3/lib/python3.7/site-packages/swh/vault/tests/test_cookers.py:347: in cook_extract_snapshot_git_bare
with cook_extract_git_bare(storage, swhid, fsck=fsck,) as res:
/usr/lib/python3.7/contextlib.py:112: in __enter__
return next(self.gen)
.tox/py3/lib/python3.7/site-packages/swh/vault/tests/test_cookers.py:310: in cook_extract_git_bare
cooker.prepare_bundle()
.tox/py3/lib/python3.7/site-packages/swh/vault/cookers/git_bare.py:135: in prepare_bundle
self.push_subgraph(self.obj_type, self.obj_id)
.tox/py3/lib/python3.7/site-packages/swh/vault/cookers/git_bare.py:302: in push_subgraph
self.push_snapshot_subgraph(obj_id)
.tox/py3/lib/python3.7/site-packages/swh/vault/cookers/git_bare.py:452: in push_snapshot_subgraph
self.push_revision_subgraph(branch.target)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.vault.cookers.git_bare.GitBareCooker object at 0x7f04f953d160>
obj_id = b'\xd1[\x12\xf9\xdfn\xf6 \x02&H\xc5\r\xd8\xa6\x86\x92\x15\x1a%'
def push_revision_subgraph(self, obj_id: Sha1Git) -> None:
"""Fetches a revision and all its children, and writes them to disk"""
loaded_from_graph = False
if self.graph:
from swh.graph.client import GraphArgumentException
# First, try to cook using swh-graph, as it is more efficient than
# swh-storage for querying the history
obj_swhid = CoreSWHID(object_type=ObjectType.REVISION, object_id=obj_id,)
try:
revision_ids = (
swhid.object_id
for swhid in map(
CoreSWHID.from_string,
self.graph.visit_nodes(str(obj_swhid), edges="rev:rev"),
)
)
self._push(self._rev_stack, revision_ids)
except GraphArgumentException as e:
logger.info(
"Revision %s not found in swh-graph, falling back to fetching "
"history using swh-storage. %s",
hash_to_hex(obj_id),
e.args[0],
)
else:
loaded_from_graph = True
if not loaded_from_graph:
# If swh-graph is not available, or the revision is not yet in
# swh-graph, fall back to self.storage.revision_log.
# self.storage.revision_log also gives us the full revisions,
# so we load them right now instead of just pushing them on the stack.
walker = DFSRevisionsWalker(self.storage, obj_id, state=self._walker_state)
for revision in walker:
self.write_revision_node(revision)
> self.nb_loaded += 1
E AttributeError: 'GitBareCooker' object has no attribute 'nb_loaded'
.tox/py3/lib/python3.7/site-packages/swh/vault/cookers/git_bare.py:384: AttributeError
TEST RESULT
TEST RESULT
- Run At
- Nov 23 2021, 4:08 PM