This commit is contained in:
mrT23
2024-07-11 18:30:16 +03:00
parent 4b351cfe38
commit eccd00b86f
2 changed files with 122 additions and 6 deletions

View File

@ -6,7 +6,7 @@ from typing import Optional
from pr_agent.config_loader import get_settings
from pr_agent.algo.types import FilePatchInfo
from pr_agent.log import get_logger
MAX_FILES_ALLOWED_FULL = 50
class GitProvider(ABC):
@abstractmethod
@ -51,6 +51,12 @@ class GitProvider(ABC):
def edit_comment(self, comment, body: str):
pass
def edit_comment_from_comment_id(self, comment_id: int, body: str):
pass
def get_comment_body_from_comment_id(self, comment_id: int) -> str:
pass
def reply_to_comment_from_comment_id(self, comment_id: int, body: str):
pass
@ -74,6 +80,7 @@ class GitProvider(ABC):
# if the existing description wasn't generated by the pr-agent, just return it as-is
if not self._is_generated_by_pr_agent(description_lowercase):
get_logger().info(f"Existing description was not generated by the pr-agent")
self.user_description = description
return description
# if the existing description was generated by the pr-agent, but it doesn't contain a user description,
@ -120,12 +127,18 @@ class GitProvider(ABC):
def get_repo_settings(self):
pass
def get_workspace_name(self):
return ""
def get_pr_id(self):
return ""
def get_line_link(self, relevant_file: str, relevant_line_start: int, relevant_line_end: int = None) -> str:
return ""
def get_lines_link_original_file(self, filepath:str, component_range: Range) -> str:
return ""
#### comments operations ####
@abstractmethod
def publish_comment(self, pr_comment: str, is_temporary: bool = False):
@ -166,6 +179,7 @@ class GitProvider(ABC):
pass
self.publish_comment(pr_comment)
@abstractmethod
def publish_inline_comment(self, body: str, relevant_file: str, relevant_line_in_file: str):
pass