mirror of
https://github.com/karma-riuk/crab.git
synced 2025-07-05 13:38:12 +02:00
now archiving both before (context for AI) and after (tests for benchmark)
This commit is contained in:
@ -197,7 +197,7 @@ def get_comments(pr: PullRequest) -> list[Comment]:
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def archive_repo(repo_path: str, pr_number: int, destination: str) -> None:
|
def archive_repo(repo_path: str, pr_number: int, destination: str, post_fix: str) -> None:
|
||||||
"""
|
"""
|
||||||
Archives the repo at the specified path, including only the files tracked by git.
|
Archives the repo at the specified path, including only the files tracked by git.
|
||||||
The archive is stored in the destination directory with a filename based on the PR number.
|
The archive is stored in the destination directory with a filename based on the PR number.
|
||||||
@ -205,7 +205,7 @@ def archive_repo(repo_path: str, pr_number: int, destination: str) -> None:
|
|||||||
if not os.path.exists(destination):
|
if not os.path.exists(destination):
|
||||||
os.makedirs(destination)
|
os.makedirs(destination)
|
||||||
|
|
||||||
archive_name = f"repo_pr_{pr_number}.tar.gz"
|
archive_name = f"{repo_path.replace('/', '_')}_{pr_number}_{post_fix}.tar.gz"
|
||||||
archive_path = os.path.join(destination, archive_name)
|
archive_path = os.path.join(destination, archive_name)
|
||||||
|
|
||||||
result = run_git_cmd(["ls-files"], repo_path)
|
result = run_git_cmd(["ls-files"], repo_path)
|
||||||
@ -274,11 +274,18 @@ def process_pull(
|
|||||||
lambda: entry.comments.extend(get_comments(pr)),
|
lambda: entry.comments.extend(get_comments(pr)),
|
||||||
),
|
),
|
||||||
("Checkout out base commit...", lambda: checkout(repo_path, pr.base.sha, pr.number)),
|
("Checkout out base commit...", lambda: checkout(repo_path, pr.base.sha, pr.number)),
|
||||||
("Archiving the repo...", lambda: archive_repo(repo_path, pr.number, archive_destination)),
|
(
|
||||||
|
"Archiving the repo...",
|
||||||
|
lambda: archive_repo(repo_path, pr.number, archive_destination, "base"),
|
||||||
|
),
|
||||||
(
|
(
|
||||||
"Checkout out merge commit...",
|
"Checkout out merge commit...",
|
||||||
lambda: checkout(repo_path, pr.merge_commit_sha, pr.number),
|
lambda: checkout(repo_path, pr.merge_commit_sha, pr.number),
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"Archiving the repo...",
|
||||||
|
lambda: archive_repo(repo_path, pr.number, archive_destination, "merged"),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
pbar = tqdm(total=len(setup_steps) + 6, desc="Processing PR", leave=False)
|
pbar = tqdm(total=len(setup_steps) + 6, desc="Processing PR", leave=False)
|
||||||
|
Reference in New Issue
Block a user