MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / collect_commits

Function collect_commits

tools/commitlist.py:244–273  ·  view source on GitHub ↗
(
    base_ref: str, head_ref: str, use_merge_base: bool
)

Source from the content-addressed store, hash-verified

242
243
244def collect_commits(
245 base_ref: str, head_ref: str, use_merge_base: bool
246) -> list[CommitRecord]:
247 start_ref = base_ref
248 if use_merge_base:
249 start_ref = run_git('merge-base', base_ref, head_ref)
250 raw_log = run_git(
251 'log',
252 '--reverse',
253 '--pretty=format:%H%x1f%s%x1f%an%x1e',
254 f'{start_ref}..{head_ref}',
255 )
256 if not raw_log:
257 return []
258
259 commits = []
260 for record in raw_log.split('\x1e'):
261 record = record.strip()
262 if not record:
263 continue
264 commit_hash, title, author = record.split('\x1f')
265 commits.append(
266 CommitRecord(
267 commit_hash=commit_hash,
268 title=title,
269 git_author=author,
270 pr_number=extract_pr_number(title),
271 )
272 )
273 return commits
274
275
276class PullRequestCache:

Callers 1

mainFunction · 0.85

Calls 5

run_gitFunction · 0.85
CommitRecordClass · 0.85
extract_pr_numberFunction · 0.85
splitMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected