git_interface.utils

Methods that don’t fit in their own file

async git_interface.utils.add_to_staged(git_repo, path, *extra_paths)

Add files to the repository staging area

param git_repo:

Where the repo is

param path:

The path to add

param *extra_paths:

Add more paths

raises GitException:

Error to do with git

Parameters:
  • git_repo (Path | str)

  • path (str)

  • extra_paths (str)

async git_interface.utils.clone_repo(git_repo, src, bare=False, mirror=False, depth=None)

Clone an exiting repo, please note this method has no way of passing passwords+usernames

param git_repo:

Repo path to clone into

param src:

Where to clone from

param bare:

Use –bare git argument, defaults to False

param mirror:

Use –mirror git argument, defaults to False

param depth:

Use –depth git argument, defaults to None

raises ValueError:

Both bare and mirror are True

raises GitException:

Error to do with git

Parameters:
  • git_repo (Path | str)

  • src (str)

  • depth (None | int)

async git_interface.utils.commit_staged(git_repo, messages)

Commit staged files with a message(s)

param git_repo:

Where the repo is

param messages:

A single message or multiple

raises GitException:

Error to do with git

Parameters:
  • git_repo (Path | str)

  • messages (str | tuple[str])

async git_interface.utils.get_description(git_repo)

Gets the set description for a repo

param git_repo:

Path to the repo

return:

The description

Parameters:

git_repo (Path | str)

Return type:

str

async git_interface.utils.get_version()

Gets the git version

raises GitException:

Error to do with git

return:

The version

Return type:

str

async git_interface.utils.init_repo(repo_dir, repo_name, bare=True, default_branch=None)

Creates a new git repo in the directory with the given name, if bare the repo name will have .git added at the end.

param repo_dir:

Where the repo will be

param repo_name:

The name of the repo

param bare:

Whether the repo is bare, defaults to True

param default_branch:

The branch name to use, defaults to None

raises AlreadyExistsException:

A repo already exists

raises GitException:

Error to do with git

Parameters:
  • repo_dir (Path)

  • repo_name (str)

  • bare (bool)

  • default_branch (str | None)

async git_interface.utils.run_maintenance(git_repo)

Run a maintenance git command to specified repo

param git_repo:

Where the repo is

raises GitException:

Error to do with git

Parameters:

git_repo (Path | str)

async git_interface.utils.set_description(git_repo, description)

Sets the set description for a repo

param git_repo:

Path to the repo

Parameters:
  • git_repo (Path | str)

  • description (str)