MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / get_sha

Function get_sha

util/misc.py:331–350  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

329
330
331def get_sha():
332 cwd = os.path.dirname(os.path.abspath(__file__))
333
334 def _run(command):
335 return subprocess.check_output(command,
336 cwd=cwd).decode('ascii').strip()
337
338 sha = 'N/A'
339 diff = 'clean'
340 branch = 'N/A'
341 try:
342 sha = _run(['git', 'rev-parse', 'HEAD'])
343 subprocess.check_output(['git', 'diff'], cwd=cwd)
344 diff = _run(['git', 'diff-index', 'HEAD'])
345 diff = 'has uncommited changes' if diff else 'clean'
346 branch = _run(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
347 except Exception:
348 pass
349 message = f'sha: {sha}, status: {diff}, branch: {branch}'
350 return message
351
352
353def collate_fn(batch):

Callers

nothing calls this directly

Calls 1

_runFunction · 0.85

Tested by

no test coverage detected