swh.loader.git.utils module¶
Utilities helper functions
-
swh.loader.git.utils.
init_git_repo_from_archive
(project_name, archive_path, root_temp_dir='/tmp')[source]¶ Given a path to an archive containing a git repository.
Uncompress that archive to a temporary location and returns the path.
If any problem whatsoever is raised, clean up the temporary location.
- Parameters
project_name (str) – Project’s name
archive_path (str) – Full path to the archive
root_temp_dir (str) – Optional temporary directory mount point (default to /tmp)
- Returns
A tuple: - temporary folder: containing the mounted repository - repo_path, path to the mounted repository inside the temporary folder
- Raises
ValueError in case of failure to run the command to uncompress
-
swh.loader.git.utils.
check_date_time
(timestamp)[source]¶ Check date time for overflow errors.
- Parameters
timestamp (timestamp) – Timestamp in seconds
- Raises
Any error raised by datetime fromtimestamp conversion error. –
-
swh.loader.git.utils.
ignore_branch_name
(branch_name: bytes) → bool[source]¶ Should the git loader ignore the branch named branch_name?
-
swh.loader.git.utils.
filter_refs
(refs: Dict[bytes, bytes]) → Dict[bytes, bytes][source]¶ Filter the refs dictionary using the policy set in ignore_branch_name
-
swh.loader.git.utils.
warn_dangling_branches
(branches: Dict[bytes, Optional[swh.model.model.SnapshotBranch]], dangling_branches: Dict[bytes, bytes], logger: logging.Logger, origin_url: str) → None[source]¶