iblrig.version_management.call_git

iblrig.version_management.call_git(*args, cache_output=True, on_error='raise')[source]

Call a git command with the specified arguments.

This function executes a git command with the provided arguments. It can cache the output of the command and handle errors based on the specified behavior.

Parameters:
  • *args (str) – The arguments to pass to the git command.

  • cache_output (bool, optional) – Whether to cache the output of the command. Default is True.

  • on_error (str, optional) – The behavior when an error occurs. Either - ‘raise’: raise the exception (default), - ‘log’: log the exception, or - ‘silence’: suppress the exception.

Returns:

The output of the git command as a string, or None if an error occurred.

Return type:

str or None

Raises:
  • RuntimeError – If the installation is not managed through git and on_error is set to ‘raise’.

  • SubprocessError – If the command fails and on_error is set to ‘raise’.

Parameters:
  • args (str)

  • cache_output (bool)

  • on_error (Literal['raise', 'log', 'silence'])