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

Function parse_remote

ci/scripts/jenkins/git_utils.py:169–188  ·  view source on GitHub ↗

Get a GitHub (user, repo) pair out of a git remote

(remote: str)

Source from the content-addressed store, hash-verified

167
168
169def parse_remote(remote: str) -> tuple[str, str]:
170 """
171 Get a GitHub (user, repo) pair out of a git remote
172 """
173 if remote.startswith("https://"):
174 # Parse HTTP remote
175 parts = remote.split("/")
176 if len(parts) < 2:
177 raise RuntimeError(f"Unable to parse remote '{remote}'")
178 user, repo = parts[-2], parts[-1].replace(".git", "")
179 else:
180 # Parse SSH remote
181 m = re.search(r":(.*)/(.*)\.git", remote)
182 if m is None or len(m.groups()) != 2:
183 raise RuntimeError(f"Unable to parse remote '{remote}'")
184 user, repo = m.groups()
185
186 user = os.getenv("DEBUG_USER", user)
187 repo = os.getenv("DEBUG_REPO", repo)
188 return user, repo
189
190
191def git(command, **kwargs):

Callers 9

check_pr_titleFunction · 0.90
ping_reviewers.pyFile · 0.90
update_branch.pyFile · 0.90
github_tvmbot.pyFile · 0.90

Calls 2

splitMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…