reposync

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.

Parameters
  • 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

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.

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

property hexsha: Optional[str]

Returns the hexsha of the last commit.