MCPcopy Create free account
hub / github.com/apache/solr / _git_ref_output

Method _git_ref_output

dev-tools/scripts/validateChangelogs.py:281–286  ·  view source on GitHub ↗

Execute git command on a branch ref, trying local then remote. Helper for file/tree operations.

(self, cmd: List[str], branch: str, rel_path: str)

Source from the content-addressed store, hash-verified

279 return str(error)
280
281 def _git_ref_output(self, cmd: List[str], branch: str, rel_path: str) -> Optional[str]:
282 """Execute git command on a branch ref, trying local then remote. Helper for file/tree operations."""
283 result = self.run_git([*cmd, f"{branch}:{rel_path}"], check=False)
284 if result.returncode != 0 and (remote := self._find_apache_remote()):
285 result = self.run_git([*cmd, f"{remote}/{branch}:{rel_path}"], check=False)
286 return result.stdout if result.returncode == 0 else None
287
288 def _get_file_from_branch(self, branch: str, rel_path: str) -> Optional[str]:
289 """Read a file from a branch, trying local first, then remote."""

Callers 2

_get_file_from_branchMethod · 0.95
_get_tree_from_branchMethod · 0.95

Calls 2

run_gitMethod · 0.95
_find_apache_remoteMethod · 0.95

Tested by

no test coverage detected