swh.loader.mercurial.directory module#

swh.loader.mercurial.directory.clone_repository(repo_url: str, hg_changeset: str, target: Path) Path[source]#

Clone repo_url repository in the target directory at hg_changeset (mercurial changeset or tag).

This function can raise for various reasons. This is expected to be caught by the main loop in the loader.

Raises

NotFound: exception if the origin to ingest is not found

Returns

the local clone repository directory path

class swh.loader.mercurial.directory.HgCheckoutLoader(*args, **kwargs)[source]#

Bases: BaseDirectoryLoader

Hg directory loader in charge of ingesting a mercurial tree at a specific changeset, tag or branch into the swh archive.

The output snapshot is of the form:

id: <bytes>
branches:
  HEAD:
    target_type: alias
    target: <mercurial-reference>
  <mercurial-reference>:
    target_type: directory
    target: <directory-id>
visit_type: str = 'hg-checkout'#
fetch_artifact() Iterator[Path][source]#

This fetches an artifact representation and yields its associated local representation (as Path). Depending on the implementation, this may yield contents coming from a remote location, or directories coming from tarball, svn tree, git tree, hg tree, …

Raises

NotFound if nothing is found; ValueError in case of mismatched checksums

build_snapshot() Snapshot[source]#

Build snapshot without losing the hg reference context.

origin: Origin#
loaded_snapshot_id: Optional[bytes]#
parent_origins: Optional[List[Origin]]#

If the given origin is a “forge fork” (ie. created with the “Fork” button of GitHub-like forges), build_extrinsic_origin_metadata() sets this to a list of origins it was forked from; closest parent first.

snapshot: Optional[model.Snapshot]#
artifact_path: Optional[Path]#
mirror_urls: List[str]#
directory: Optional[from_disk.Directory]#
cnts: List[model.Content]#
skipped_cnts: List[model.SkippedContent]#
dirs: List[model.Directory]#