reposync
Manage updates to automated git repositories.
- exception spicerack.reposync.RepoSyncError[source]
Bases:
SpicerackError
Exception raised for push errors.
- exception spicerack.reposync.RepoSyncNoChangeError[source]
Bases:
RepoSyncError
Exception raised for push errors.
- exception spicerack.reposync.RepoSyncPushError[source]
Bases:
RepoSyncError
Exception raised for push errors.
- class spicerack.reposync.RepoSync(repo: git.repo.base.Repo, username: str, remote_hosts: spicerack.remote.RemoteHosts, *, dry_run: bool) None [source]
Bases:
object
Class for syncing git repos.
Initialise the object.
- Parameters:
repo (
git.repo.base.Repo
) -- the path to the git repository.username (
str
) -- The username making the changes.remote_hosts (
spicerack.remote.RemoteHosts
) -- A remotes hosts object pointing to all git remote servers. The servers are expected to have a validKEYHOLDER_SOCK
configured.dry_run (
bool
) -- don't preform any write actions.
- force_sync() None [source]
Force a sync of the repo on the current host to all remotes.
- Return type:
- update(message: str) collections.abc.Generator [source]
Context manager for updating a temporary directory with new data.
The context manager will create and yield a temporary directory. Users should populate this directory with fresh data to be committed to the main repository.
- Parameters:
message (
str
) -- the commit message.- Yields:
pathlib.Path -- temporary directory to populate with data intended for the git repo.
- Raises:
spicerack.reposync.RepoSyncError -- if unable to update local repo.
- Return type: