MCPcopy Create free account
hub / github.com/pytorch/executorch / git_hash

Method git_hash

setup.py:120–136  ·  view source on GitHub ↗

The current git hash, if known.

(cls)

Source from the content-addressed store, hash-verified

118
119 @classmethod
120 def git_hash(cls) -> Optional[str]:
121 """The current git hash, if known."""
122 if cls.__git_hash_attr is None:
123 import subprocess
124
125 try:
126 cls.__git_hash_attr = (
127 subprocess.check_output(
128 ["git", "rev-parse", "HEAD"], cwd=cls._root_dir()
129 )
130 .decode("ascii")
131 .strip()
132 )
133 except subprocess.CalledProcessError:
134 cls.__git_hash_attr = "" # Non-None but empty.
135 # A non-None but empty value indicates that we don't know it.
136 return cls.__git_hash_attr if cls.__git_hash_attr else None
137
138 @classmethod
139 def string(cls) -> str:

Callers 2

stringMethod · 0.80
write_to_python_fileMethod · 0.80

Calls 2

_root_dirMethod · 0.80
decodeMethod · 0.45

Tested by

no test coverage detected