swh.loader.svn.utils module

swh.loader.svn.utils.strdate_to_timestamp(strdate: Optional[str])swh.model.model.Timestamp[source]

Convert a string date to an int timestamp.

Parameters
  • strdate – A string representing a date with format like

  • 'YYYY-mm-DDTHH – MM:SS.800722Z’

Returns

seconds, microseconds

Return type

A couple of integers

class swh.loader.svn.utils.OutputStream(fileno)[source]

Bases: object

Helper class to read lines from a program output while it is running

Parameters

fileno (int) – File descriptor of a program output stream opened in text mode

read_lines()[source]

Read available lines from the output stream and return them.

Returns

A tuple whose first member is the read

lines and second member a boolean indicating if there are still some other lines available to read.

Return type

Tuple[List[str], bool]

swh.loader.svn.utils.init_svn_repo_from_dump(dump_path, prefix=None, suffix=None, root_dir='/tmp', gzip=False)[source]

Given a path to a svn dump. Initialize an svn repository with the content of said dump.

Returns

  • temporary folder (str): containing the mounted repository

  • repo_path (str): path to the mounted repository inside the

    temporary folder

Return type

A tuple

Raises
  • ValueError in case of failure to run the command to uncompress

  • and load the dump.

swh.loader.svn.utils.init_svn_repo_from_archive_dump(archive_path, prefix=None, suffix=None, root_dir='/tmp')[source]

Given a path to an archive containing an svn dump. Initialize an svn repository with the content of said dump.

Returns

  • temporary folder (str): containing the mounted repository

  • repo_path (str): path to the mounted repository inside the

    temporary folder

Return type

A tuple

Raises
  • ValueError in case of failure to run the command to uncompress

  • and load the dump.