acquaint.sync#
Private-repository sync for the data root: create the repository private, refuse anything else, guard every push.
init creates the GitHub repository through gh as private, refuses to
continue unless gh repo view --json visibility reports PRIVATE, makes the data
root its checkout, and installs a pre-push hook. The hook, and push and pull
in Python, re-check that:
the push goes through
origin, which has exactly one URL, the one recorded at init;no
pushurldiffers from it, and nourl.*.pushInsteadOfrewrites it;that URL is one of the forms that name the recorded repository on github.com (
github_urls(), the same list the hook spells out);ghreports the repository, on github.com whateverGH_HOSTsays, as private.
The hook is installed in the repository’s shared hooks folder, executable, and
core.hooksPath points at it by absolute path, so linked worktrees are guarded too and
a global core.hooksPath cannot silently disable it. init takes over only an empty
folder, or a clone of that same repository; it refuses any other existing repository.
What this does not protect, stated plainly:
a private repository is access control, not encryption: the host can read it all;
git push --no-verifyskips the hook;whoever can change this repository’s git config, or which
ghruns onPATH, controls what the guard sees;moving the data root breaks the absolute hook path until
sync init --existing-onlyruns again (sync pushrefuses in that state; a rawgit pushdoes not);file names and commit messages carry people’s names;
deleting a folder does not remove it from history, other clones, or backups.
git-remote-gcrypt, which would encrypt contents, names and history, is not supported
yet: the guard does not recognise its internal push, so init refuses gcrypt:: URLs.
Every git and gh call goes through run, so tests can script gh while
git runs for real.
Module Attributes
acquaint's own store. |
Functions
|
Every remote URL accepted for a GitHub repository. |
|
Make |
|
Re-check the remote and its visibility, then rebase local work onto it (uncommitted edits are stashed and restored). |
|
Commit, rebase onto the remote, and push, after re-checking the remote, the guard and the visibility. |
|
Run |
|
Whether only the repository's owner can read it, and why not: private, owned by a person (not an organisation), that person its only collaborator, no invitation pending. |
|
Whether the store is synced, where to, uncommitted changes, ahead/behind, the guard, and live visibility. |
|
|
Classes
|
Everything that names the application using this mechanism: one value, so another app can reuse it unchanged. |
- acquaint.sync.ACQUAINT = SyncNamespace(name='acquaint', command='acquaint sync', subject='profile data', store='profile', description='acquaint profile store (private)', gitignore='# generated, never synced\n_index/\n.DS_Store\n')#
acquaint’s own store.
- Type:
The default
- class acquaint.sync.SyncNamespace(name='acquaint', command='acquaint sync', subject='profile data', store='profile', description='acquaint profile store (private)', gitignore='# generated, never synced\n_index/\n.DS_Store\n')[source]#
Bases:
objectEverything that names the application using this mechanism: one value, so another app can reuse it unchanged.
nameprefixes the git config keys (<name>.repo,<name>.remote) and the default commit messages;commandis what error messages tell the user to run (<command> init,<command> push);subjectis what the guard refuses to push to a non-private repository (“profile data”).
- acquaint.sync.github_urls(repo)[source]#
Every remote URL accepted for a GitHub repository. The pre-push hook spells out the same six forms.
>>> github_urls("example/profiles") ['git@github.com:example/profiles.git', 'git@github.com:example/profiles', 'ssh://git@github.com/example/profiles.git', 'ssh://git@github.com/example/profiles', 'https://github.com/example/profiles.git', 'https://github.com/example/profiles']
- acquaint.sync.init(root, repo, *, remote_url=None, create=True, dry_run=False, namespace=SyncNamespace(name='acquaint', command='acquaint sync', subject='profile data', store='profile', description='acquaint profile store (private)', gitignore='# generated, never synced\n_index/\n.DS_Store\n'), run=<function run_command>)[source]#
Make
roota checkout of the private GitHub repositoryrepo, creating it (private) if needed.
- acquaint.sync.pull(root, *, dry_run=False, namespace=SyncNamespace(name='acquaint', command='acquaint sync', subject='profile data', store='profile', description='acquaint profile store (private)', gitignore='# generated, never synced\n_index/\n.DS_Store\n'), run=<function run_command>)[source]#
Re-check the remote and its visibility, then rebase local work onto it (uncommitted edits are stashed and restored).
- acquaint.sync.push(root, *, message=None, entities=(), everything=False, allow_markers=(), dry_run=False, namespace=SyncNamespace(name='acquaint', command='acquaint sync', subject='profile data', store='profile', description='acquaint profile store (private)', gitignore='# generated, never synced\n_index/\n.DS_Store\n'), run=<function run_command>)[source]#
Commit, rebase onto the remote, and push, after re-checking the remote, the guard and the visibility.
entitiesare record folders (people/ada-lovelace): only those, plusSTORE_FILESwhen one of them is a deleted record, are committed; everything else stays uncommitted, so one session does not sweep up another’s unfinished records. Withoutentitiesevery change is committed, but when amessageis given it must name each record being committed (its id appears in the text as a word) unlesseverythingis set; a message naming only some of them is refused, listing the rest. A file holding conflict markers is refused, unless its store-relative path is inallow_markers(a record that quotes a conflict block on purpose). With nomessagethe default one lists the records. A renamed record needs both its old and new folder named.
- acquaint.sync.run_command(args, *, cwd=None)[source]#
Run
gitorgh(ghpinned to github.com), capturing text output.- Return type:
- acquaint.sync.sole_access(repo, *, run=<function run_command>)[source]#
Whether only the repository’s owner can read it, and why not: private, owned by a person (not an organisation), that person its only collaborator, no invitation pending.
This decides whether profile edits may be committed and pushed without the operator reviewing the diff first: nobody else will see them.
- acquaint.sync.status(root, *, check_visibility=True, namespace=SyncNamespace(name='acquaint', command='acquaint sync', subject='profile data', store='profile', description='acquaint profile store (private)', gitignore='# generated, never synced\n_index/\n.DS_Store\n'), run=<function run_command>)[source]#
Whether the store is synced, where to, uncommitted changes, ahead/behind, the guard, and live visibility.
With
check_visibility,auto_commitsays whether edits may be committed and pushed without the operator reviewing them first (sole_access()), andauto_commit_reasonsays why or why not.