stubber.basicgit

simple Git module, where needed via powershell

Module Contents

Functions

_run_git(cmd[, repo, expect_stderr, capture_output, ...])

run a external (git) command in the repo's folder and deal with some of the errors

clone(→ bool)

git clone [--depth 1] [--branch <tag_name>] <remote> <directory>

get_tag(→ Union[str, None])

get the most recent git version tag of a local repo

get_tags(→ List[str])

get list of tag of a local repo

checkout_tag(→ bool)

checkout a specific git tag

synch_submodules(→ bool)

make sure any submodules are in syncj

checkout_commit(→ bool)

Checkout a specific commit

switch_tag(→ bool)

switch to the specified version tag of a local repo

switch_branch(→ bool)

switch to the specified branch in a local repo"

fetch(→ bool)

fetches a repo

pull(→ bool)

pull a repo origin into main

stubber.basicgit._run_git(cmd: List[str], repo: Optional[Union[pathlib.Path, str]] = 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
stubber.basicgit.clone(remote_repo: str, path: pathlib.Path, shallow=False, tag: Optional[str] = None) bool

git clone [–depth 1] [–branch <tag_name>] <remote> <directory>

Parameters
Return type

bool

stubber.basicgit.get_tag(repo: Optional[Union[str, pathlib.Path]] = None, abbreviate: bool = True) Union[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
Return type

Union[str, None]

stubber.basicgit.get_tags(repo: Optional[pathlib.Path] = None, minver: Optional[str] = None) List[str]

get list of tag of a local repo

Parameters
Return type

List[str]

stubber.basicgit.checkout_tag(tag: str, repo: Optional[Union[str, pathlib.Path]] = None) bool

checkout a specific git tag

Parameters
Return type

bool

stubber.basicgit.synch_submodules(repo: Optional[Union[pathlib.Path, str]] = None) bool

make sure any submodules are in syncj

Parameters

repo (Optional[Union[pathlib.Path, str]]) –

Return type

bool

stubber.basicgit.checkout_commit(commit_hash: str, repo: Optional[Union[pathlib.Path, str]] = None) bool

Checkout a specific commit

Parameters
Return type

bool

stubber.basicgit.switch_tag(tag: str, repo: Optional[Union[pathlib.Path, str]] = 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
Return type

bool

stubber.basicgit.switch_branch(branch: str, repo: Optional[Union[pathlib.Path, str]] = 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
Return type

bool

stubber.basicgit.fetch(repo: Union[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

bool

stubber.basicgit.pull(repo: Union[pathlib.Path, str], branch='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]) –

Return type

bool