mass_driver.git

Manipulating git repos natively, without much knowledge of mass-driver models

Module Contents

Functions

clone_if_remote

Build a GitRepo; If repo_path isn’t a directory, clone it

get_cache_folder

Create a cache folder, either locally or in temp

commit

Commit the repo’s changes in branch_name, given the PatchDriver that did it

push

Push a branch of the repo to a remote

switch_branch_then_pull

Switch branch then pull

get_default_branch

Get the default branch of a repository

Data

DEFAULT_CACHE

API

mass_driver.git.DEFAULT_CACHE = None
mass_driver.git.clone_if_remote(repo_path: str, cache_folder: pathlib.Path, logger: logging.Logger) git.Repo[source]

Build a GitRepo; If repo_path isn’t a directory, clone it

mass_driver.git.get_cache_folder(cache: bool, logger: logging.Logger) pathlib.Path[source]

Create a cache folder, either locally or in temp

mass_driver.git.commit(repo: git.Repo, migration: mass_driver.models.migration.MigrationLoaded)[source]

Commit the repo’s changes in branch_name, given the PatchDriver that did it

mass_driver.git.push(repo: git.Repo, branch_name: str)[source]

Push a branch of the repo to a remote

mass_driver.git.switch_branch_then_pull(repo: git.Repo, pull: bool, branch_name: str | None = None)[source]

Switch branch then pull

mass_driver.git.get_default_branch(r: git.Repo) str[source]

Get the default branch of a repository