swh.loader.git.from_disk module

class swh.loader.git.from_disk.GitLoaderFromDisk(url, visit_date=None, directory=None, config=None)[source]

Bases: swh.loader.core.loader.DVCSLoader

Load a git repository from a directory.

CONFIG_BASE_FILENAME = 'loader/git-disk'
visit_type = 'git'
prepare_origin_visit(*args, **kwargs)[source]

First step executed by the loader to prepare origin and visit references. Set/update self.origin, and optionally self.origin_url, self.visit_date.

prepare(*args, **kwargs)[source]

Second step executed by the loader to prepare some state needed by the loader.

iter_objects()[source]
get_object(oid)[source]
Given an object id, return the object if it is found and not

malformed in some way.

Parameters

oid (bytes) – the object’s identifier

Returns

The object if found without malformation

fetch_data()[source]

Fetch the data from the data source

has_contents()[source]

Checks whether we need to load contents

get_content_ids()[source]

Get the content identifiers from the git repository

get_contents()[source]

Get the contents that need to be loaded

has_directories()[source]

Checks whether we need to load directories

get_directory_ids()[source]

Get the directory identifiers from the git repository

get_directories()[source]

Get the directories that need to be loaded

has_revisions()[source]

Checks whether we need to load revisions

get_revision_ids()[source]

Get the revision identifiers from the git repository

get_revisions()[source]

Get the revisions that need to be loaded

has_releases()[source]

Checks whether we need to load releases

get_release_ids()[source]

Get the release identifiers from the git repository

get_releases()[source]

Get the releases that need to be loaded

get_snapshot()[source]

Turn the list of branches into a snapshot to load

get_fetch_history_result()[source]

Return the data to store in fetch_history for the current loader

save_data()[source]

We already have the data locally, no need to save it

load_status()[source]

The load was eventful if the current occurrences are different to the ones we retrieved at the beginning of the run

class swh.loader.git.from_disk.GitLoaderFromArchive(*args, archive_path, **kwargs)[source]

Bases: swh.loader.git.from_disk.GitLoaderFromDisk

Load a git repository from an archive.

This loader ingests a git repository compressed into an archive. The supported archive formats are .zip and .tar.gz.

From an input tarball named my-git-repo.zip, the following layout is expected in it:

my-git-repo/
├── .git
│   ├── branches
│   ├── COMMIT_EDITMSG
│   ├── config
│   ├── description
│   ├── HEAD
...

Nevertheless, the loader is able to ingest tarballs with the following layouts too:

.
├── .git
│   ├── branches
│   ├── COMMIT_EDITMSG
│   ├── config
│   ├── description
│   ├── HEAD
...

or:

other-repo-name/
├── .git
│   ├── branches
│   ├── COMMIT_EDITMSG
│   ├── config
│   ├── description
│   ├── HEAD
...
project_name_from_archive(archive_path)[source]

Compute the project name from the archive’s path.

prepare(*args, **kwargs)[source]
  1. Uncompress the archive in temporary location.

  2. Prepare as the GitLoaderFromDisk does

  3. Load as GitLoaderFromDisk does

cleanup()[source]

Cleanup the temporary location (if it exists).