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, origin_url, local_dirname, max_content_length)[source]

Bases: object

Svn repository representation.

Parameters
  • remote_url (str) –

  • origin_url (str) – Associated origin identifier

  • local_dirname (str) – Path to write intermediary svn action results

head_revision()[source]

Retrieve current head revision.

initial_revision()[source]

Retrieve the initial revision from which the remote url appeared.

convert_commit_message(msg)[source]

Simply encode the commit message.

Parameters

msg (str) – the commit message to convert.

Returns

The transformed message as bytes.

convert_commit_date(date)[source]

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

Parameters

date (str) – the commit date to convert.

Returns

The transformed date.

convert_commit_author(author)[source]

Convert the commit author into an swh person.

Parameters

author (str) – the commit author to convert.

Returns

a model object

Return type

Person

logs(revision_start, revision_end)[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

export(revision)[source]

Export the repository to a given version.

export_temporary(revision)[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, end_revision)[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 - nextrev: next revision - commit: commit data (author, date, message) for such revision - objects_per_path: dictionary of path, swh hash data with type

swh_hash_data_at_revision(revision)[source]

Compute the hash data at revision.

Expected to be used for update only.

clean_fs(local_dirname=None)[source]

Clean up the local working copy.

Parameters
  • local_dirname (str) – Path to remove recursively if

  • Otherwise (provided.) –

  • the temporary upper root tree (remove) –

  • for svn repository loading. (used) –