stubber.basicgit
¶
Simple Git module, where needed via powershell
Some of the functions are based on the PyGithub module
Module Contents¶
Functions¶
|
run a external (git) command in the repo's folder and deal with some of the errors |
|
git clone [--depth 1] [--branch <tag_name>] <remote> <directory> |
|
get the most recent git version tag of a local repo |
|
get list of all tags of a local repo |
|
Get list of tag of a repote github repo |
|
checkout a specific git tag |
|
make sure any submodules are in sync |
|
Checkout a specific commit |
|
switch to the specified version tag of a local repo |
|
switch to the specified branch in a local repo" |
|
fetches a repo |
|
pull a repo origin into main |
|
Based on MicroPython makeversionhdr.py |
Attributes¶
- stubber.basicgit.PAT_NO_ACCESS¶
- stubber.basicgit.PAT¶
- stubber.basicgit.GH_CLIENT¶
- stubber.basicgit._run_local_git(cmd: List[str], repo: pathlib.Path | str | None = None, expect_stderr=False, capture_output=True, echo_output=True)¶
run a external (git) command in the repo’s folder and deal with some of the errors
- Parameters:
cmd (List[str]) –
repo (Optional[Union[pathlib.Path, str]]) –
- stubber.basicgit.clone(remote_repo: str, path: pathlib.Path, shallow: bool = False, tag: str | None = None) bool ¶
git clone [–depth 1] [–branch <tag_name>] <remote> <directory>
- Parameters:
remote_repo (str) –
path (pathlib.Path) –
shallow (bool) –
tag (Optional[str]) –
- Return type:
- stubber.basicgit.get_local_tag(repo: str | pathlib.Path | None = None, abbreviate: bool = True) str | None ¶
get the most recent git version tag of a local repo repo Path should be in the form of : repo = “./repo/micropython”
returns the tag or None
- Parameters:
repo (Optional[Union[str, pathlib.Path]]) –
abbreviate (bool) –
- Return type:
Union[str, None]
- stubber.basicgit.get_local_tags(repo: pathlib.Path | None = None, minver: str | None = None) List[str] ¶
get list of all tags of a local repo
- Parameters:
repo (Optional[pathlib.Path]) –
minver (Optional[str]) –
- Return type:
List[str]
- stubber.basicgit.get_tags(repo: str, minver: str | None = None) List[str] ¶
Get list of tag of a repote github repo
- stubber.basicgit.checkout_tag(tag: str, repo: str | pathlib.Path | None = None) bool ¶
checkout a specific git tag
- Parameters:
tag (str) –
repo (Optional[Union[str, pathlib.Path]]) –
- Return type:
- stubber.basicgit.sync_submodules(repo: pathlib.Path | str | None = None) bool ¶
make sure any submodules are in sync
- Parameters:
repo (Optional[Union[pathlib.Path, str]]) –
- Return type:
- stubber.basicgit.checkout_commit(commit_hash: str, repo: pathlib.Path | str | None = None) bool ¶
Checkout a specific commit
- Parameters:
commit_hash (str) –
repo (Optional[Union[pathlib.Path, str]]) –
- Return type:
- stubber.basicgit.switch_tag(tag: str | pathlib.Path, repo: pathlib.Path | str | None = None) bool ¶
switch to the specified version tag of a local repo repo should be in the form of : path/.git repo = ‘../micropython/.git’ returns None
- Parameters:
tag (Union[str, pathlib.Path]) –
repo (Optional[Union[pathlib.Path, str]]) –
- Return type:
- stubber.basicgit.switch_branch(branch: str, repo: pathlib.Path | str | None = None) bool ¶
switch to the specified branch in a local repo” repo should be in the form of : path/.git repo = ‘../micropython/.git’ returns None
- Parameters:
branch (str) –
repo (Optional[Union[pathlib.Path, str]]) –
- Return type:
- stubber.basicgit.fetch(repo: pathlib.Path | str) bool ¶
fetches a repo repo should be in the form of : path/.git repo = ‘../micropython/.git’ returns True on success
- Parameters:
repo (Union[pathlib.Path, str]) –
- Return type:
- stubber.basicgit.pull(repo: pathlib.Path | str, branch: str = 'main') bool ¶
pull a repo origin into main repo should be in the form of : path/.git repo = ‘../micropython/.git’ returns True on success
- Parameters:
repo (Union[pathlib.Path, str]) –
branch (str) –
- Return type: