teachbooks.external_content.git module

Process git repo URLs.

teachbooks.external_content.git.create_repository_dir_name(url: str, root_dir: str | Path) str

Generate the path where the repo will be cloned to.

It will be of the form:

{root_path}/{platform}_{organization}_{repository}/{revision}

Parameters:
  • url – URL path to the external content.

  • root_dir – root directory where the repo will be cloned into.

Returns:

Path where the repo will be cloned to.

teachbooks.external_content.git.get_branch_tag_name(url: str) str

Get branch_tag_name by searching for between blob and book in external_url.

Parameters:

url – URL path to the external content.

Returns:

branch or tag name.

teachbooks.external_content.git.get_repo_url(url: str) str

Get repo url by searching for reg like https://*/*/*/.

Parameters:

url – URL path to the external content

Returns:

repository URL