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#
- 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#
- link#
- 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
- 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.
- 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.
- close()[source]#
Function called when we finish processing a repository.
SVN external definitions are processed by it.
- 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.
- 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.