This document contains a SWH loader for ingesting repository data from Bazaar or Breezy.
- exception swh.loader.bzr.loader.UnknownRepositoryFormat#
The repository we’re trying to load is using an unknown format. It’s possible (though unlikely) that a new format has come out, we should check before dismissing the repository as broken or unsupported.
- class swh.loader.bzr.loader.BzrDirectory(data=None)#
A more practical directory.
creates missing parent directories
removes empty directories
- swh.loader.bzr.loader.sort_changes(change: TreeChange) str #
Key function for sorting the changes by path.
Sorting allows us to group the folders together (for example “b”, then “a/a”, then “a/b”). Reversing this sort in the sorted() call will make it so the files appear before the folder (“a/a”, then “a”) if the folder has changed. This removes a bug where the order of operations is:
“a” goes from directory to file, removing all of its subtree
“a/a” is removed, but our structure has already forgotten it
- class swh.loader.bzr.loader.BazaarLoader(storage: StorageInterface, url: str, directory: Optional[str] = None, visit_date: Optional[datetime] = None, temp_directory: str = '/tmp', clone_timeout_seconds: int = 7200, **kwargs: Any)#
Loads a Bazaar repository
- pre_cleanup() None #
As a first step, will try and check for dangling data to cleanup. This should do its best to avoid raising issues.
- load_status() Dict[str, str] #
Detailed loading status.
Defaults to logging an eventful load.
- Returns: a dictionary that is eventually passed back as the task’s
result to the scheduler, allowing tuning of the task recurrence mechanism.
Upgrade both repository and branch to the most recent supported version to be compatible with the loader.
- fetch_data() bool #
Fetch the data from the source the loader is currently loading
a value that is interpreted as a boolean. If True, fetch_data needs to be called again to complete loading.
- store_release(name: bytes, target: bytes) bytes #
Store a release given its name and its target.
name – name of the release.
target – sha1_git of the target revision.
the sha1_git of the stored release.
- property branch: Branch#
Returns the only branch in the current repository.
Bazaar branches can be assimilated to repositories in other VCS like Git or Mercurial. By contrast, a Bazaar repository is just a store of revisions to optimize disk usage, with no particular semantics.
- property head_revision_id: bytes#
Returns the Bazaar revision id of the branch’s head.
Bazaar branches do not have multiple heads.