flowbber.utils.git

Utilities for git repositories.

Functions

  • find_git(): Find the git executable.
  • find_tag(): Find the tag for the current revision.
  • find_root(): Find the root of the git repository.
  • find_branch(): Find the current branch of the git repository.
  • find_revision(): Find the current revision (short hash) of the git repository.
  • find_name(): Find the name of the author of the current revision.
  • find_email(): Find the email of the author of the current revision.
  • find_subject(): Find the commit message subject of current revision.
  • find_body(): Find the commit message body of current revision.
  • find_date(): Find the commit date in strict ISO 8601 format.
flowbber.utils.git.find_git()

Find the git executable.

Returns
Absolute path to the git executable.
Return type
str
flowbber.utils.git.find_tag(git=None, directory='.')

Find the tag for the current revision.

Parameters
  • git (str) – Path to git executable. If None, the default, will try to find it using find_git().
  • directory (str) – Run as if git was started in directory instead of the current working directory.
Returns

The name of the tag pointing to the current revision. Raises GitError if no tag is found.

Return type

str

flowbber.utils.git.find_root(git=None, directory='.')

Find the root of the git repository.

Parameters
  • git (str) – Path to git executable. If None, the default, will try to find it using find_git().
  • directory (str) – Run as if git was started in directory instead of the current working directory.
Returns

Absolute path to root of the git repository.

Return type

str

flowbber.utils.git.find_branch(git=None, directory='.')

Find the current branch of the git repository.

Parameters
  • git (str) – Path to git executable. If None, the default, will try to find it using find_git().
  • directory (str) – Run as if git was started in directory instead of the current working directory.
Returns

The name of the branch the git repository is currently on.

Return type

str

flowbber.utils.git.find_revision(git=None, directory='.')

Find the current revision (short hash) of the git repository.

Parameters
  • git (str) – Path to git executable. If None, the default, will try to find it using find_git().
  • directory (str) – Run as if git was started in directory instead of the current working directory.
Returns

The short version of the revision the git repository is currently on.

Return type

str

flowbber.utils.git.find_name(git=None, directory='.')

Find the name of the author of the current revision.

Parameters
  • git (str) – Path to git executable. If None, the default, will try to find it using find_git().
  • directory (str) – Run as if git was started in directory instead of the current working directory.
Returns

The name of the author of the current revision.

Return type

str

flowbber.utils.git.find_email(git=None, directory='.')

Find the email of the author of the current revision.

Parameters
  • git (str) – Path to git executable. If None, the default, will try to find it using find_git().
  • directory (str) – Run as if git was started in directory instead of the current working directory.
Returns

The email of the author of the current revision.

Return type

str

flowbber.utils.git.find_subject(git=None, directory='.')

Find the commit message subject of current revision.

Parameters
  • git (str) – Path to git executable. If None, the default, will try to find it using find_git().
  • directory (str) – Run as if git was started in directory instead of the current working directory.
Returns

The commit message subject of current revision.

Return type

str

flowbber.utils.git.find_body(git=None, directory='.')

Find the commit message body of current revision.

Parameters
  • git (str) – Path to git executable. If None, the default, will try to find it using find_git().
  • directory (str) – Run as if git was started in directory instead of the current working directory.
Returns

The commit message body of current revision.

Return type

str

flowbber.utils.git.find_date(git=None, directory='.')

Find the commit date in strict ISO 8601 format.

Parameters
  • git (str) – Path to git executable. If None, the default, will try to find it using find_git().
  • directory (str) – Run as if git was started in directory instead of the current working directory.
Returns

The commit date in strict ISO 8601 format.

Return type

str