swh.loader.svn.svn module

SVN client in charge of iterating over svn logs and yield commit representations including the hash tree/content computations per svn commit.

class swh.loader.svn.svn.SvnRepo(remote_url: str, origin_url: str, local_dirname: str, max_content_length: int, from_dump: bool = False)[source]

Bases: object

Svn repository representation.

Parameters
  • remote_url – Remove svn repository url

  • origin_url – Associated origin identifier

  • local_dirname – Path to write intermediary svn action results

head_revision() int[source]

Retrieve current head revision.

initial_revision() int[source]

Retrieve the initial revision from which the remote url appeared.

convert_commit_message(msg: Union[str, bytes]) bytes[source]

Simply encode the commit message.

Parameters

msg – the commit message to convert.

Returns

The transformed message as bytes.

convert_commit_date(date: bytes) swh.model.model.TimestampWithTimezone[source]

Convert the message commit date into a timestamp in swh format. The precision is kept.

Parameters

date – the commit date to convert.

Returns

The transformed date.

convert_commit_author(author: Optional[bytes]) swh.model.model.Person[source]

Convert the commit author into an swh person.

Parameters

author – the commit author to convert.

Returns

Person as model object

logs(revision_start: int, revision_end: int) Iterator[Dict][source]

Stream svn logs between revision_start and revision_end by chunks of block_size logs.

Yields revision and associated revision information between the revision start and revision_end.

Parameters
  • revision_start – the svn revision starting bound

  • revision_end – the svn revision ending bound

Yields

tuple

tuple of revisions and logs:

  • revisions: list of revisions in order

  • logs: Dictionary with key revision number and value the log entry. The log entry is a dictionary with the following keys:

    • author_date: date of the commit

    • author_name: name of the author

    • message: commit message

commit_info(revision: int) Optional[Dict][source]

Return commit information.

Parameters

revision – svn revision to return commit info

Returns

A dictionary filled with commit info, see swh.loader.svn.svn.logs() for details about its content.

remote_access(auth: _ra.Auth) subvertpy.ra.RemoteAccess[source]

Simple wrapper around subvertpy.ra.RemoteAccess creation enabling to retry the operation if a network error occurs.

info(origin_url: str)[source]

Simple wrapper around subvertpy.client.Client.info enabling to retry the command if a network error occurs.

export(url: str, to: str, rev: Optional[int] = None, peg_rev: Optional[int] = None, recurse: bool = True, ignore_externals: bool = False, overwrite: bool = False, ignore_keywords: bool = False) int[source]

Simple wrapper around subvertpy.client.Client.export enabling to retry the command if a network error occurs.

See documentation of svn_client_export5 function from subversion C API to get details about parameters.

checkout(url: str, path: str, rev: Optional[int] = None, peg_rev: Optional[int] = None, recurse: bool = True, ignore_externals: bool = False, allow_unver_obstructions: bool = False) int[source]

Simple wrapper around subvertpy.client.Client.checkout enabling to retry the command if a network error occurs.

See documentation of svn_client_checkout3 function from subversion C API to get details about parameters.

propget(name: str, target: str, peg_rev: Optional[int], rev: Optional[int] = None, recurse: bool = False)[source]

Simple wrapper around subvertpy.client.Client.propget enabling to retry the command if a network error occurs.

See documentation of svn_client_propget5 function from subversion C API to get details about parameters.

export_temporary(revision: int) Tuple[str, bytes][source]

Export the repository to a given revision in a temporary location. This is up to the caller of this function to clean up the temporary location when done (cf. self.clean_fs method)

Parameters

revision – Revision to export at

Returns

The tuple local_dirname the temporary location root folder, local_url where the repository was exported.

swh_hash_data_per_revision(start_revision: int, end_revision: int) Iterator[Tuple[int, Dict, Tuple[List[swh.model.model.Content], List[swh.model.model.SkippedContent], List[swh.model.model.Directory]], swh.model.from_disk.Directory]][source]

Compute swh hash data per each revision between start_revision and end_revision.

Parameters
  • start_revision – starting revision

  • end_revision – ending revision

Yields

Tuple (rev, nextrev, commit, objects_per_path)

  • rev: current revision

  • commit: commit data (author, date, message) for such revision

  • objects_per_path: Tuple of list of objects between start_revision and end_revision

  • complete Directory representation

swh_hash_data_at_revision(revision: int) Tuple[Dict, swh.model.from_disk.Directory][source]

Compute the information at a given svn revision. This is expected to be used for checks only.

Yields

The tuple (commit dictionary, targeted directory object).

clean_fs(local_dirname: Optional[str] = None) None[source]

Clean up the local working copy.

Parameters

local_dirname – Path to remove recursively if provided. Otherwise, remove the temporary upper root tree used for svn repository loading.