hermes.commands.init.util.git_info
Attributes
Functions
|
Returns the given cwd if valid or the default_cwd / os.getcwd() when not cwd is given. |
|
Runs any git command using subprocess. Raises Exception when returncode != 0. |
|
Returns a list of all remotes. |
|
Takes any url produced by 'git remote get-url ...' and returns a consistent version with https & without '.git'. |
|
Returns the url of the given remote. |
|
Returns the name of the current branch. |
|
Uses the --version command to check whether git is installed. |
Module Contents
- hermes.commands.init.util.git_info.get_valid_cwd(cwd='') str
Returns the given cwd if valid or the default_cwd / os.getcwd() when not cwd is given.
- hermes.commands.init.util.git_info.run_git_command(command: str, cwd='', throw_exception=False) str
Runs any git command using subprocess. Raises Exception when returncode != 0. :param command: The command as string with or without the ‘git’ main command. :param cwd: Path to target directory ( if it differs from os.getcwd() ). :return: The command’s output.
- hermes.commands.init.util.git_info.convert_remote_url(url: str) str
Takes any url produced by ‘git remote get-url …’ and returns a consistent version with https & without ‘.git’.