Manage updates to automated git repositories.

exception spicerack.reposync.RepoSyncError[source]

Bases: spicerack.exceptions.SpicerackError

Exception raised for push errors.

exception spicerack.reposync.RepoSyncNoChangeError[source]

Bases: spicerack.reposync.RepoSyncError

Exception raised for push errors.

exception spicerack.reposync.RepoSyncPushError[source]

Bases: spicerack.reposync.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)[source]

Bases: object

Class for syncing git repos.

Initialise the object.

  • repo (git.repo.base.Repo) -- the path to the repo

  • username (str) -- The username making the change

  • remote_hosts (spicerack.remote.RemoteHosts) -- A remotes hosts object pointing to all git remote servers. The servers are expected to have a valid KEYHOLDER_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.

update(message: str) 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.


message (str) -- the commit message


pathlib.Path -- temporary directory to populate with data intended for the git repo


spicerack.reposync.RepoSyncError -- if unable to update local repo

property hexsha: Optional[str]

Returns the hexsha of the last commit.