Browse Source

Skip temporary metadata dependency resolution if there are no dependencies

tags/v1.1
JustAnotherArchivist 1 year ago
parent
commit
c02859987f
1 changed files with 13 additions and 11 deletions
  1. +13
    -11
      codearchiver/modules/git.py

+ 13
- 11
codearchiver/modules/git.py View File

@@ -271,18 +271,20 @@ class Git(codearchiver.core.Module):

# Bundling completed without issues; wait for depended-on bundles, add them to the metadata, then replace own temporary metadata
if self._storage:
self._storage.wait_temporary_metadata(tmpMetadataDependencies)
if tmpMetadataDependencies:
self._storage.wait_temporary_metadata(tmpMetadataDependencies)
with self._storage.lock():
criteria = [('Module', type(self).name), ('Root commit', tuple(rootCommits)), ('Object', tuple(baseInProgressObjects))]
missingObjects = baseInProgressObjects.copy()
for oldBundleName, oldObjects, oldOids in self._find_storage_bundles(criteria, {value.split(' ', 1)[0] for value in baseInProgressObjects}):
metadata.append('Based on bundle', oldBundleName)
baseOids |= oldOids
missingObjects -= oldObjects

# Verification: all commit/tag objects collected from temporary metadata must be covered
if missingObjects:
raise RuntimeError('Resolved temporary metadata bundles do not cover all expected objects')
if tmpMetadataDependencies:
criteria = [('Module', type(self).name), ('Root commit', tuple(rootCommits)), ('Object', tuple(baseInProgressObjects))]
missingObjects = baseInProgressObjects.copy()
for oldBundleName, oldObjects, oldOids in self._find_storage_bundles(criteria, {value.split(' ', 1)[0] for value in baseInProgressObjects}):
metadata.append('Based on bundle', oldBundleName)
baseOids |= oldOids
missingObjects -= oldObjects

# Verification: all commit/tag objects collected from temporary metadata must be covered
if missingObjects:
raise RuntimeError('Resolved temporary metadata bundles do not cover all expected objects')

# Verification: all objects in the clone are either in a base bundle or in the index
# This can only be done here because all oids are needed, not just the commit/tag objects


Loading…
Cancel
Save