MCPcopy Create free account
hub / github.com/MiniMax-AI/VTP / get_sha

Function get_sha

vtp/models/utils/utils.py:86–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84
85
86def get_sha() -> str:
87 cwd = os.path.dirname(os.path.abspath(__file__))
88
89 def _run(command):
90 return subprocess.check_output(command, cwd=cwd).decode("ascii").strip()
91
92 sha = "N/A"
93 diff = "clean"
94 branch = "N/A"
95 try:
96 sha = _run(["git", "rev-parse", "HEAD"])
97 subprocess.check_output(["git", "diff"], cwd=cwd)
98 diff = _run(["git", "diff-index", "HEAD"])
99 diff = "has uncommited changes" if diff else "clean"
100 branch = _run(["git", "rev-parse", "--abbrev-ref", "HEAD"])
101 except Exception:
102 pass
103 message = f"sha: {sha}, status: {diff}, branch: {branch}"
104 return message
105
106
107def get_conda_env() -> Tuple[Optional[str], Optional[str]]:

Callers

nothing calls this directly

Calls 1

_runFunction · 0.85

Tested by

no test coverage detected