MCPcopy Create free account
hub / github.com/ResearAI/DeepScientist / compare_refs

Function compare_refs

src/deepscientist/gitops/diff.py:177–195  ·  view source on GitHub ↗
(repo: Path, *, base: str, head: str)

Source from the content-addressed store, hash-verified

175
176
177def compare_refs(repo: Path, *, base: str, head: str) -> dict[str, Any]:
178 _require_ref(repo, base)
179 _require_ref(repo, head)
180 merge_base = _git_stdout(repo, ["merge-base", base, head]).strip() or None
181 ahead, behind = _ahead_behind(repo, base, head)
182 commits = _compare_commits(repo, base=base, head=head)
183 files = _compare_files(repo, base=base, head=head)
184 return {
185 "ok": True,
186 "base": base,
187 "head": head,
188 "merge_base": merge_base,
189 "ahead": ahead,
190 "behind": behind,
191 "commit_count": len(commits),
192 "file_count": len(files),
193 "commits": commits,
194 "files": files,
195 }
196
197
198def diff_file_between_refs(repo: Path, *, base: str, head: str, path: str) -> dict[str, Any]:

Callers 3

diff_file_between_refsFunction · 0.85
git_compareMethod · 0.85
git_actionMethod · 0.85

Calls 5

_require_refFunction · 0.85
_git_stdoutFunction · 0.85
_ahead_behindFunction · 0.85
_compare_commitsFunction · 0.85
_compare_filesFunction · 0.85

Tested by

no test coverage detected