MCPcopy Index your code
hub / github.com/python/cpython / get_diff_files

Function get_diff_files

Doc/tools/check-warnings.py:47–65  ·  view source on GitHub ↗

List the files changed between two Git refs, filtered by change type.

(ref_a: str, ref_b: str, filter_mode: str = "")

Source from the content-addressed store, hash-verified

45
46
47def get_diff_files(ref_a: str, ref_b: str, filter_mode: str = "") -> set[Path]:
48 """List the files changed between two Git refs, filtered by change type."""
49 added_files_result = subprocess.run(
50 [
51 "git",
52 "diff",
53 f"--diff-filter={filter_mode}",
54 "--name-only",
55 f"{ref_a}...{ref_b}",
56 "--",
57 ],
58 stdout=subprocess.PIPE,
59 check=True,
60 text=True,
61 encoding="UTF-8",
62 )
63
64 added_files = added_files_result.stdout.strip().split("\n")
65 return {Path(file.strip()) for file in added_files if file.strip()}
66
67
68def get_diff_lines(ref_a: str, ref_b: str, file: Path) -> list[int]:

Callers 1

process_touched_warningsFunction · 0.85

Calls 4

PathClass · 0.90
runMethod · 0.45
splitMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…