diff --git a/pull_requests.py b/pull_requests.py index 3a51e58..bd6ef1c 100644 --- a/pull_requests.py +++ b/pull_requests.py @@ -10,7 +10,7 @@ from datetime import datetime from dataset import Dataset, DatasetEntry, FileData, Metadata from handlers import HandlerException, get_build_handler -from utils import has_only_1_comment, move_github_logging_to_file, clone +from utils import has_only_1_comment, move_github_logging_to_file, clone, run_git_cmd def get_good_projects(csv_file: str) -> pd.DataFrame: @@ -42,15 +42,6 @@ def is_pull_good(pull: PullRequest, verbose: bool = False) -> bool: return has_only_1_comment(pull.get_commits(), pull.get_review_comments(), verbose=verbose) -def run_git_cmd(cmd: list[str], repo_path: str) -> subprocess.CompletedProcess: - return subprocess.run( - ["git", "-C", repo_path] + cmd, - check=True, - capture_output=True, - text=True, - ) - - def ensure_full_history(repo_path: str) -> None: result = run_git_cmd(["rev-parse", "--is-shallow-repository"], repo_path) @@ -96,7 +87,8 @@ def process_pull( try: diffs_after = { - file.filename: file.patch for file in repo.compare(first_commit.sha, last_commit.sha).files + file.filename: file.patch + for file in repo.compare(first_commit.sha, last_commit.sha).files } except GithubException as e: return diff --git a/utils.py b/utils.py index 9def89c..9611de0 100644 --- a/utils.py +++ b/utils.py @@ -147,3 +147,11 @@ def clone(repo: str, dest: str, updates: dict = {}, force: bool = False, verbose else: updates["cloned_successfully"] = True return True + +def run_git_cmd(cmd: list[str], repo_path: str) -> subprocess.CompletedProcess: + return subprocess.run( + ["git", "-C", repo_path] + cmd, + check=True, + capture_output=True, + text=True, + )