MCPcopy Index your code
hub / github.com/python/mypy / git_commit_log

Function git_commit_log

misc/generate_changelog.py:48–66  ·  view source on GitHub ↗
(rev1: str, rev2: str)

Source from the content-addressed store, hash-verified

46
47
48def git_commit_log(rev1: str, rev2: str) -> list[CommitInfo]:
49 result = subprocess.run(
50 ["git", "log", "--pretty=%H\t%an\t%s", f"{rev1}..{rev2}"],
51 text=True,
52 capture_output=True,
53 check=True,
54 )
55 commits = []
56 for line in result.stdout.splitlines():
57 commit, author, title = line.strip().split("\t", 2)
58 pr_number = None
59 if m := re.match(r".*\(#([0-9]+)\) *$", title):
60 pr_number = int(m.group(1))
61 title = re.sub(r" *\(#[0-9]+\) *$", "", title)
62
63 author = normalize_author(author)
64 entry = CommitInfo(commit, author, title, pr_number)
65 commits.append(entry)
66 return commits
67
68
69def filter_omitted_commits(commits: list[CommitInfo]) -> list[CommitInfo]:

Callers 1

Calls 9

intClass · 0.85
normalize_authorFunction · 0.85
CommitInfoClass · 0.85
splitlinesMethod · 0.80
splitMethod · 0.80
stripMethod · 0.80
groupMethod · 0.80
appendMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…