multipackage.utilities.git module

Basic git operations.

Summary

Classes:

GITRepository Helper class for git repository functionality.

Functions:

extract_github_name Extract a github name from a remote URL.

Reference

class multipackage.utilities.git.GITRepository(path)[source]

Bases: object

Helper class for git repository functionality.

Parameters:path (str) – The path to a git repository folder.
status()[source]

Call git status and parse the results.

remote(name='origin')[source]

Get the remote origin URL.

Parameters:name (str) – The name of the remote to get.
Returns:The remote URL.
Return type:str
github_name(name='origin')[source]

Get the user/org and repo name for a github hosted repo.

Parameters:name (str) – The name of the remote to get.
Returns:The github org/username and repo name.
Return type:(str, str)
github_slug()[source]

Get the github slug from this repository.

This is a string of the format user/repo_name.

classmethod version()[source]

Return the version of git installed.

multipackage.utilities.git.extract_github_name(remote)[source]

Extract a github name from a remote URL.

Parameters:remote (str) – A git remote URL
Returns:The user and repo names.

If the repo cannot be found or is not hosted on Github, None is Returned.

Return type:(str, str)