MCPcopy Create free account
hub / github.com/apache/tvm / does_commit_exist

Function does_commit_exist

ci/scripts/jenkins/should_rebuild_docker.py:67–81  ·  view source on GitHub ↗

Returns True if the hash exists in the repo

(hash: str)

Source from the content-addressed store, hash-verified

65
66
67def does_commit_exist(hash: str) -> bool:
68 """
69 Returns True if the hash exists in the repo
70 """
71 sh = Sh()
72 cmd = f"git rev-parse -q {hash}"
73 proc = sh.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=False)
74 print(proc.stdout)
75 if proc.returncode == 0:
76 return True
77
78 if "unknown revision or path not in the working tree" in proc.stdout:
79 return False
80
81 raise RuntimeError(f"Unexpected failure when running: {cmd}")
82
83
84def find_hash_for_tag(tag: dict[str, Any]) -> str:

Callers 1

find_commit_in_repoFunction · 0.85

Calls 3

runMethod · 0.95
ShClass · 0.90
printFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…