Skip to content

Commit 2d0b53a

Browse files
committed
Fixes
1 parent 186a09d commit 2d0b53a

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

patchwork/common/client/scm.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -409,16 +409,12 @@ def reset_comments(self) -> None:
409409
self.git_client.delete_comment(repository_id=self._pr.repository.id, pull_request_id=self.id, thread_id=thread.id, comment_id=comment_id, project=self._pr.repository.project.id)
410410

411411
def texts(self) -> PullRequestTexts:
412-
self.git_client.get_commit_diffs(
413-
repository_id=self._pr.repository.id,
414-
project=self._pr.repository.project.id
415-
)
416-
417412
target_branch = self._pr.last_merge_source_commit.commit_id
418413
feature_branch = self._pr.last_merge_target_commit.commit_id
419414

420415
repo = git.Repo(path=Path.cwd(), search_parent_directories=True)
421-
repo.git.fetch()
416+
for remote in repo.remotes:
417+
remote.fetch()
422418
target_commit = repo.commit(target_branch)
423419
feature_commit = repo.commit(feature_branch)
424420

patchwork/steps/CreatePRComment/CreatePRComment.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from patchwork.common.client.scm import GithubClient, GitlabClient
1+
from patchwork.common.client.scm import GithubClient, GitlabClient, AzureDevopsClient
22
from patchwork.logger import logger
33
from patchwork.step import Step, StepStatus
44

@@ -15,6 +15,8 @@ def __init__(self, inputs: dict):
1515
self.scm_client = GithubClient(inputs["github_api_key"])
1616
elif "gitlab_api_key" in inputs.keys():
1717
self.scm_client = GitlabClient(inputs["gitlab_api_key"])
18+
elif "azuredevops_api_key" in inputs.keys():
19+
self.scm_client = AzureDevopsClient(inputs["azuredevops_api_key"])
1820
else:
1921
raise ValueError(f'Missing required input data: "github_api_key" or "gitlab_api_key"')
2022

patchwork/steps/CreatePRComment/typed.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ class __CreatePRCommentRequiredInputs(TypedDict):
1111
class CreatePRCommentInputs(__CreatePRCommentRequiredInputs, total=False):
1212
noisy_comments: Annotated[bool, StepTypeConfig(is_config=True)]
1313
scm_url: Annotated[str, StepTypeConfig(is_config=True)]
14-
gitlab_api_key: Annotated[str, StepTypeConfig(is_config=True, or_op=["github_api_key"])]
15-
github_api_key: Annotated[str, StepTypeConfig(is_config=True, or_op=["gitlab_api_key"])]
14+
gitlab_api_key: Annotated[str, StepTypeConfig(is_config=True, or_op=["github_api_key", "azuredevops_api_key"])]
15+
github_api_key: Annotated[str, StepTypeConfig(is_config=True, or_op=["gitlab_api_key", "azuredevops_api_key"])]
16+
azuredevops_api_key: Annotated[str, StepTypeConfig(is_config=True, or_op=["gitlab_api_key", "github_api_key"])]
1617

1718

1819
class CreatePRCommentOutputs(TypedDict):

patchwork/steps/ReadPRDiffs/ReadPRDiffs.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing_extensions import List
22

3-
from patchwork.common.client.scm import GithubClient, GitlabClient
3+
from patchwork.common.client.scm import GithubClient, GitlabClient, AzureDevopsClient
44
from patchwork.step import Step
55
from patchwork.steps.ReadPRDiffs.typed import ReadPRDiffsInputs, ReadPRDiffsOutputs
66

@@ -26,17 +26,16 @@ def filter_by_extension(file, extensions):
2626

2727

2828
class ReadPRDiffs(Step, input_class=ReadPRDiffsInputs, output_class=ReadPRDiffsOutputs):
29-
required_keys = {"pr_url"}
3029

3130
def __init__(self, inputs: dict):
3231
super().__init__(inputs)
33-
if not all(key in inputs.keys() for key in self.required_keys):
34-
raise ValueError(f'Missing required data: "{self.required_keys}"')
3532

3633
if "github_api_key" in inputs.keys():
3734
self.scm_client = GithubClient(inputs["github_api_key"])
3835
elif "gitlab_api_key" in inputs.keys():
3936
self.scm_client = GitlabClient(inputs["gitlab_api_key"])
37+
elif "azuredevops_api_key" in inputs.keys():
38+
self.scm_client = AzureDevopsClient(inputs["azuredevops_api_key"])
4039
else:
4140
raise ValueError(f'Missing required input data: "github_api_key" or "gitlab_api_key"')
4241

patchwork/steps/ReadPRDiffs/typed.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ class __ReadPRDiffsRequiredInputs(TypedDict):
1010

1111
class ReadPRDiffsInputs(__ReadPRDiffsRequiredInputs, total=False):
1212
scm_url: Annotated[str, StepTypeConfig(is_config=True)]
13-
gitlab_api_key: Annotated[str, StepTypeConfig(is_config=True, or_op=["github_api_key"])]
14-
github_api_key: Annotated[str, StepTypeConfig(is_config=True, or_op=["gitlab_api_key"])]
13+
gitlab_api_key: Annotated[str, StepTypeConfig(is_config=True, or_op=["github_api_key", "azuredevops_api_key"])]
14+
github_api_key: Annotated[str, StepTypeConfig(is_config=True, or_op=["gitlab_api_key", "azuredevops_api_key"])]
15+
azuredevops_api_key: Annotated[str, StepTypeConfig(is_config=True, or_op=["gitlab_api_key", "github_api_key"])]
1516

1617

1718
class ReadPRDiffsOutputs(TypedDict):

0 commit comments

Comments
 (0)