mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-06 22:00:40 +08:00
Remove non implemented method _prepare_clone_url_with_token from providers which don't support it and instead, issue a warning in base class.
This commit is contained in:
@ -623,6 +623,3 @@ class AzureDevopsProvider(GitProvider):
|
|||||||
|
|
||||||
def get_line_link(self, relevant_file: str, relevant_line_start: int, relevant_line_end: int = None) -> str:
|
def get_line_link(self, relevant_file: str, relevant_line_start: int, relevant_line_end: int = None) -> str:
|
||||||
return self.pr_url+f"?_a=files&path={relevant_file}"
|
return self.pr_url+f"?_a=files&path={relevant_file}"
|
||||||
|
|
||||||
def _prepare_clone_url_with_token(self, repo_url_to_clone: str) -> str | None:
|
|
||||||
raise Exception("Not implemented!")
|
|
||||||
|
@ -495,6 +495,3 @@ class CodeCommitProvider(GitProvider):
|
|||||||
lang: round(count / total_files * 100) for lang, count in lang_count.items()
|
lang: round(count / total_files * 100) for lang, count in lang_count.items()
|
||||||
}
|
}
|
||||||
return lang_percentage
|
return lang_percentage
|
||||||
|
|
||||||
def _prepare_clone_url_with_token(self, repo_url_to_clone: str) -> str | None:
|
|
||||||
raise Exception("Not implemented!")
|
|
||||||
|
@ -397,6 +397,3 @@ class GerritProvider(GitProvider):
|
|||||||
|
|
||||||
def get_pr_branch(self):
|
def get_pr_branch(self):
|
||||||
return self.repo.head
|
return self.repo.head
|
||||||
|
|
||||||
def _prepare_clone_url_with_token(self, repo_url_to_clone: str) -> str | None:
|
|
||||||
raise Exception("Not implemented!")
|
|
||||||
|
@ -46,9 +46,10 @@ class GitProvider(ABC):
|
|||||||
shutil.rmtree(self.path, ignore_errors=True)
|
shutil.rmtree(self.path, ignore_errors=True)
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
#Method to allow implementors to manipulate the repo url to clone (such as embedding tokens in the url string).
|
#Method to allow implementors to manipulate the repo url to clone (such as embedding tokens in the url string). Needs to be implemented by the provider.
|
||||||
def _prepare_clone_url_with_token(self, repo_url_to_clone: str) -> str | None:
|
def _prepare_clone_url_with_token(self, repo_url_to_clone: str) -> str | None:
|
||||||
pass
|
get_logger().warning("Not implemented! Returning None")
|
||||||
|
return None
|
||||||
|
|
||||||
# Does a shallow clone, using a forked process to support a timeout guard.
|
# Does a shallow clone, using a forked process to support a timeout guard.
|
||||||
# In case operation has failed, it is expected to throw an exception as this method does not return a value.
|
# In case operation has failed, it is expected to throw an exception as this method does not return a value.
|
||||||
|
@ -190,6 +190,3 @@ class LocalGitProvider(GitProvider):
|
|||||||
|
|
||||||
def get_pr_labels(self, update=False):
|
def get_pr_labels(self, update=False):
|
||||||
raise NotImplementedError('Getting labels is not implemented for the local git provider')
|
raise NotImplementedError('Getting labels is not implemented for the local git provider')
|
||||||
|
|
||||||
def _prepare_clone_url_with_token(self, repo_url_to_clone: str) -> str | None:
|
|
||||||
raise Exception("Not implemented!")
|
|
||||||
|
Reference in New Issue
Block a user