Git#
- class mobu.storage.git.Git(*, repo=None, config_location=None, logger=None)#
Bases:
objectA 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 addwith arbitrary arguments.branch(*args)Run
git branchwith arbitrary arguments.checkout(*args)Run
git checkoutwith arbitrary arguments.clone(*args)Run
git clonewith arbitrary arguments.commit(*args)Run
git commitwith arbitrary arguments.config(*args)Run
git configwith arbitrary arguments.fetch(*args)Run
git fetchwith arbitrary arguments.git(*args)Run an arbitrary git command with arbitrary string arguments.
init(*args)Run
git initwith arbitrary arguments.lfs(*args)Run
git lfswith arbitrary arguments.pull(*args)Run
git pullwith arbitrary arguments.push(*args)Run
git commitwith arbitrary arguments.Get the commit hash of the currently cloned repo.
reset(*args)Run
git resetwith arbitrary arguments.Methods Documentation
- async add(*args)#
Run
git addwith arbitrary arguments.
- async branch(*args)#
Run
git branchwith arbitrary arguments.
- async checkout(*args)#
Run
git checkoutwith arbitrary arguments.
- async clone(*args)#
Run
git clonewith arbitrary arguments.
- async commit(*args)#
Run
git commitwith arbitrary arguments.
- async config(*args)#
Run
git configwith arbitrary arguments.
- async fetch(*args)#
Run
git fetchwith 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 initwith 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 lfswith arbitrary arguments.
- async pull(*args)#
Run
git pullwith arbitrary arguments.
- async push(*args)#
Run
git commitwith arbitrary arguments.