MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / get_sha

Function get_sha

SwissArmyTransformer/examples/yolos/util/misc.py:248–265  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

246
247
248def get_sha():
249 cwd = os.path.dirname(os.path.abspath(__file__))
250
251 def _run(command):
252 return subprocess.check_output(command, cwd=cwd).decode('ascii').strip()
253 sha = 'N/A'
254 diff = "clean"
255 branch = 'N/A'
256 try:
257 sha = _run(['git', 'rev-parse', 'HEAD'])
258 subprocess.check_output(['git', 'diff'], cwd=cwd)
259 diff = _run(['git', 'diff-index', 'HEAD'])
260 diff = "has uncommited changes" if diff else "clean"
261 branch = _run(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
262 except Exception:
263 pass
264 message = f"sha: {sha}, status: {diff}, branch: {branch}"
265 return message
266
267
268def collate_fn(batch):

Callers

nothing calls this directly

Calls 1

_runFunction · 0.85

Tested by

no test coverage detected