swh.loader.svn.replay module#

Remote Access client to svn server.

class swh.loader.svn.replay.FileEditor(directory: from_disk.Directory, rootpath: bytes, path: bytes, svnrepo: SvnRepo)[source]#

Bases: object

File Editor in charge of updating file on disk and memory objects.

directory#
path#
fullpath#
svnrepo#
editor: Editor#
change_prop(key: str, value: str) None[source]#
apply_textdelta(base_checksum) Callable[[Any, bytes, BinaryIO], None][source]#
close() None[source]#

When done with a file added or modified in the current replayed revision, we export it to disk and update the from_disk model.

executable#
state#
class swh.loader.svn.replay.DirState(externals: ~typing.Dict[str, ~typing.List[~swh.loader.svn.utils.ExternalDefinition]] = <factory>, externals_paths: ~typing.Set[bytes] = <factory>)[source]#

Bases: object

Persists some directory states (eg. externals) across revisions while replaying them.

externals: Dict[str, List[ExternalDefinition]]#

Map a path in the directory to a list of (external_url, revision, relative_url) targeting it

externals_paths: Set[bytes]#

Keep track of all external paths reachable from the directory

class swh.loader.svn.replay.DirEditor(directory: from_disk.Directory, rootpath: bytes, path: bytes, dir_states: Dict[bytes, DirState], svnrepo: SvnRepo)[source]#

Bases: object

Directory Editor in charge of updating directory hashes computation.

This implementation includes empty folder in the hash computation.

directory#
rootpath#
path#
dir_states#
svnrepo#
editor#
externals: Dict[str, List[ExternalDefinition]]#
remove_child(path: bytes) None[source]#

Remove a path from the current objects.

The path can be resolved as link, file or directory.

This function takes also care of removing the link between the child and the parent.

Parameters:

path – to remove from the current objects.

open_directory(path: str, *args) DirEditor[source]#

Updating existing directory.

add_directory(path: str, copyfrom_path: str | None = None, copyfrom_rev: int = -1) DirEditor[source]#

Adding a new directory.

open_file(path: str, *args) FileEditor[source]#

Updating existing file.

add_file(path: str, copyfrom_path: str | None = None, copyfrom_rev: int = -1) FileEditor[source]#

Creating a new file.

change_prop(key: str, value: str) None[source]#

Change property callback on directory.

delete_entry(path: str, revision: int) None[source]#

Remove a path.

close()[source]#

Function called when we finish processing a repository.

SVN external definitions are processed by it.

process_external(path: str, external: ExternalDefinition, remove_target_path: bool = True, force: bool = False) None[source]#
remove_external_path(external_path: bytes, remove_subpaths: bool = True, force: bool = False, root_path: bytes | None = None) None[source]#

Remove a previously exported SVN external path from the reconstructed filesystem.

class swh.loader.svn.replay.Editor(rootpath: bytes, directory: from_disk.Directory, svnrepo: SvnRepo, temp_dir: str, debug: bool = False)[source]#

Bases: object

Editor in charge of replaying svn events and computing objects along.

This implementation accounts for empty folder during hash computations.

set_target_revision(revnum) None[source]#
abort() None[source]#
close() None[source]#
open_root(base_revnum: int) DirEditor[source]#
class swh.loader.svn.replay.Replay(conn: RemoteAccess, rootpath: bytes, svnrepo: SvnRepo, temp_dir: str, directory: from_disk.Directory | None = None, debug: bool = False)[source]#

Bases: object

Replay class.

replay(rev: int, low_water_mark: int) Directory[source]#

Replay svn actions between rev and rev+1.

This method updates in place the self.editor.directory, as well as the filesystem.

Returns:

The updated root directory

compute_objects(rev: int, low_water_mark: int) Tuple[List[Content], List[SkippedContent], List[Directory]][source]#

Compute objects added or modified at revisions rev. Expects the state to be at previous revision’s objects.

Parameters:

rev – The revision to start the replay from.

Returns:

The updated objects between rev and rev+1. Beware that this mutates the filesystem at rootpath accordingly.