Git#
- class mobu.storage.git.Git(*, repo=None, config_location=None, logger=None)#
Bases:
object
A very basic async Git client based on asyncio.subprocess.
- Parameters:
repo (
Path
|None
, default:None
) – Filesystem path for the git repository.config_location (
Path
|None
, default:None
) – Filesystem path for the file to use as the user-global Git config.logger (
BoundLogger
|None
, default:None
) – Logger to use.
Methods Summary
add
(*args)Run
git add
with arbitrary arguments.branch
(*args)Run
git branch
with arbitrary arguments.checkout
(*args)Run
git checkout
with arbitrary arguments.clone
(*args)Run
git clone
with arbitrary arguments.commit
(*args)Run
git commit
with arbitrary arguments.config
(*args)Run
git config
with arbitrary arguments.fetch
(*args)Run
git fetch
with arbitrary arguments.git
(*args)Run an arbitrary git command with arbitrary string arguments.
init
(*args)Run
git init
with arbitrary arguments.lfs
(*args)Run
git lfs
with arbitrary arguments.pull
(*args)Run
git pull
with arbitrary arguments.push
(*args)Run
git commit
with arbitrary arguments.Get the commit hash of the currently cloned repo.
reset
(*args)Run
git reset
with arbitrary arguments.Methods Documentation
- async add(*args)#
Run
git add
with arbitrary arguments.
- async branch(*args)#
Run
git branch
with arbitrary arguments.
- async checkout(*args)#
Run
git checkout
with arbitrary arguments.
- async clone(*args)#
Run
git clone
with arbitrary arguments.
- async commit(*args)#
Run
git commit
with arbitrary arguments.
- async config(*args)#
Run
git config
with arbitrary arguments.
- async fetch(*args)#
Run
git fetch
with arbitrary arguments.
- async git(*args)#
Run an arbitrary git command with arbitrary string arguments.
Constrain the environment of the subprocess: only pass HOME, LANG, PATH, and any GIT variables.
If self.repo is set, use that as the working directory. If self._config_location is set, use that as the value of GIT_CONFIG_GLOBAL, and set GIT_CONFIG_SYSTEM to the empty string.
This is intended to constrain where git looks for its definitions, making it both function in mobu business and not break developers’ git setups.
- async init(*args)#
Run
git init
with arbitrary arguments.If self.repo is None, and this is run, it will set self.repo from the last argument as a side effect. If there are no arguments, self.repo becomes the current working directory.
- async lfs(*args)#
Run
git lfs
with arbitrary arguments.
- async pull(*args)#
Run
git pull
with arbitrary arguments.
- async push(*args)#
Run
git commit
with arbitrary arguments.