7"""Get the Git HEAD revision of a specified Git repository."""
17 return os_id.startswith(
'win32')
or os_id.startswith(
'cygwin')
21 'Returns the Git HEAD for the supplied repository path as a string.'
22 if not os.path.exists(repository):
23 raise IOError(
'path does not exist')
28 version = subprocess.check_output([
36 return str(version.strip(),
'utf-8')
40 parser = argparse.ArgumentParser()
43 '--repository', action=
'store', help=
'Path to the Git repository.', required=
True
46 args = parser.parse_args()
47 repository = os.path.abspath(args.repository)
49 print(version.strip())
54if __name__ ==
'__main__':
def get_repository_version(repository)
def print(*args, **kwargs)