stubber.basicgit

simple Git module, where needed via powershell

Module Contents

Functions

_run_git(cmd: List[str], repo: Optional[str] = None, expect_stderr=False, capture_output=True)

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

clone(remote_repo: str, path: pathlib.Path, shallow=False) → bool

git clone --depth 0 <remote> <directory>

get_tag(repo: Optional[str] = None, abbreviate: bool = True) → Union[str, None]

get the most recent git version tag of a local repo

checkout_tag(tag: str, repo: Optional[str] = None) → bool

checkout a specific git tag

checkout_commit(commit_hash: str, repo: Optional[str] = None) → bool

Checkout a specific commit

switch_tag(tag: str, repo: Optional[str] = None) → bool

get the most recent git version tag of a local repo"

switch_branch(branch: str, repo: Optional[str] = None) → bool

get the most recent git version tag of a local repo"

fetch(repo: str) → bool

fetches a repo

pull(repo: str, branch='main') → bool

pull a repo origin into main

stubber.basicgit._run_git(cmd: List[str], repo: Optional[str] = None, expect_stderr=False, capture_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[str]) –

stubber.basicgit.clone(remote_repo: str, path: pathlib.Path, shallow=False) bool

git clone –depth 0 <remote> <directory>

Parameters
Return type

bool

stubber.basicgit.get_tag(repo: Optional[str] = None, abbreviate: bool = True) Union[str, None]

get the most recent git version tag of a local repo repo should be in the form of : repo = “./micropython”

returns the tag or None

Parameters
  • repo (Optional[str]) –

  • abbreviate (bool) –

Return type

Union[str, None]

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

checkout a specific git tag

Parameters
  • tag (str) –

  • repo (Optional[str]) –

Return type

bool

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

Checkout a specific commit

Parameters
  • commit_hash (str) –

  • repo (Optional[str]) –

Return type

bool

stubber.basicgit.switch_tag(tag: str, repo: Optional[str] = None) bool

get the most recent git version tag of a local repo” repo should be in the form of : path/.git repo = ‘../micropython/.git’ returns the tag or None

Parameters
  • tag (str) –

  • repo (Optional[str]) –

Return type

bool

stubber.basicgit.switch_branch(branch: str, repo: Optional[str] = None) bool

get the most recent git version tag of a local repo” repo should be in the form of : path/.git repo = ‘../micropython/.git’ returns the tag or None

Parameters
  • branch (str) –

  • repo (Optional[str]) –

Return type

bool

stubber.basicgit.fetch(repo: str) bool

fetches a repo repo should be in the form of : path/.git repo = ‘../micropython/.git’ returns True on success

Parameters

repo (str) –

Return type

bool

stubber.basicgit.pull(repo: 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 (str) –

Return type

bool