MCPcopy Create free account
hub / github.com/BillHuang2001/evogit / read_file

Function read_file

python-impl/evogit/utils/git.py:461–475  ·  view source on GitHub ↗

Read the content of the file in the specified commit.

(config: EvoGitConfig, commit: str, mode: str = "text")

Source from the content-addressed store, hash-verified

459
460
461def read_file(config: EvoGitConfig, commit: str, mode: str = "text") -> str | bytes:
462 """Read the content of the file in the specified commit."""
463 completed_proc = subprocess.run(
464 ["git", "show", f"{commit}:{config.filename}"],
465 cwd=config.git_dir,
466 check=True,
467 capture_output=True,
468 )
469
470 if mode == "text":
471 return completed_proc.stdout.decode("utf-8")
472 elif mode == "binary":
473 return completed_proc.stdout
474 else:
475 raise ValueError("mode must be either 'text' or 'binary'.")
476
477
478def batch_read_files(config: EvoGitConfig, commits: list[str]) -> list[str]:

Callers 1

batch_read_filesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected