mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 12:50:38 +08:00
support gitlab describe function
This commit is contained in:
@ -29,10 +29,10 @@ def get_pr_diff(git_provider: Union[GithubProvider, Any], token_handler: TokenHa
|
|||||||
global PATCH_EXTRA_LINES
|
global PATCH_EXTRA_LINES
|
||||||
PATCH_EXTRA_LINES = 0
|
PATCH_EXTRA_LINES = 0
|
||||||
|
|
||||||
git_provider.pr.diff_files = list(git_provider.get_diff_files())
|
diff_files = list(git_provider.get_diff_files())
|
||||||
|
|
||||||
# get pr languages
|
# get pr languages
|
||||||
pr_languages = sort_files_by_main_languages(git_provider.get_languages(), git_provider.pr.diff_files)
|
pr_languages = sort_files_by_main_languages(git_provider.get_languages(), diff_files)
|
||||||
|
|
||||||
# generate a standard diff string, with patch extension
|
# generate a standard diff string, with patch extension
|
||||||
patches_extended, total_tokens = pr_generate_extended_diff(pr_languages, token_handler,
|
patches_extended, total_tokens = pr_generate_extended_diff(pr_languages, token_handler,
|
||||||
|
@ -67,7 +67,7 @@ class GithubProvider(GitProvider):
|
|||||||
if relevant_line_in_file in line:
|
if relevant_line_in_file in line:
|
||||||
position = i
|
position = i
|
||||||
break
|
break
|
||||||
elif relevant_line_in_file[0] == '+' and relevant_line_in_file[1:] in line:
|
elif relevant_line_in_file[0] == '+' and relevant_line_in_file[1:].lstrip() in line:
|
||||||
# The model often adds a '+' to the beginning of the relevant_line_in_file even if originally
|
# The model often adds a '+' to the beginning of the relevant_line_in_file even if originally
|
||||||
# it's a context line
|
# it's a context line
|
||||||
position = i
|
position = i
|
||||||
|
@ -87,8 +87,9 @@ class GitLabProvider(GitProvider):
|
|||||||
return [change['new_path'] for change in self.mr.changes()['changes']]
|
return [change['new_path'] for change in self.mr.changes()['changes']]
|
||||||
|
|
||||||
def publish_description(self, pr_title: str, pr_body: str):
|
def publish_description(self, pr_title: str, pr_body: str):
|
||||||
logging.exception("Not implemented yet")
|
self.mr.title = pr_title
|
||||||
pass
|
self.mr.description = pr_body
|
||||||
|
self.mr.save()
|
||||||
|
|
||||||
def publish_comment(self, mr_comment: str, is_temporary: bool = False):
|
def publish_comment(self, mr_comment: str, is_temporary: bool = False):
|
||||||
comment = self.mr.notes.create({'body': mr_comment})
|
comment = self.mr.notes.create({'body': mr_comment})
|
||||||
@ -181,7 +182,7 @@ class GitLabProvider(GitProvider):
|
|||||||
found = True
|
found = True
|
||||||
edit_type = self.get_edit_type(line)
|
edit_type = self.get_edit_type(line)
|
||||||
break
|
break
|
||||||
elif relevant_line_in_file[0] == '+' and relevant_line_in_file[1:] in line:
|
elif relevant_line_in_file[0] == '+' and relevant_line_in_file[1:].lstrip() in line:
|
||||||
# The model often adds a '+' to the beginning of the relevant_line_in_file even if originally
|
# The model often adds a '+' to the beginning of the relevant_line_in_file even if originally
|
||||||
# it's a context line
|
# it's a context line
|
||||||
found = True
|
found = True
|
||||||
|
@ -96,7 +96,7 @@ class PRReviewer:
|
|||||||
del data['PR Feedback']['Security concerns']
|
del data['PR Feedback']['Security concerns']
|
||||||
data['PR Analysis']['Security concerns'] = val
|
data['PR Analysis']['Security concerns'] = val
|
||||||
|
|
||||||
if settings.config.git_provider == 'github' and \
|
if settings.config.git_provider != 'bitbucket' and \
|
||||||
settings.pr_reviewer.inline_code_comments and \
|
settings.pr_reviewer.inline_code_comments and \
|
||||||
'Code suggestions' in data['PR Feedback']:
|
'Code suggestions' in data['PR Feedback']:
|
||||||
del data['PR Feedback']['Code suggestions']
|
del data['PR Feedback']['Code suggestions']
|
||||||
|
Reference in New Issue
Block a user