read_git_commit_timestamp_for_file

documenteer.sphinxconfig.utils.read_git_commit_timestamp_for_file(filepath, repo_path=None)

Obtain the timestamp for the most recent commit to a given file in a Git repository.

Parameters
  • filepath (str) – Repository-relative path for a file.

  • repo_path (str, optional) – Path to the Git repository. Leave as None to use the current working directory.

Returns

commit_timestamp – The datetime of a the most recent commit to the given file.

Return type

datetime.datetime

Raises

IOError – Raised if the filepath does not exist in the Git repository.