-
Notifications
You must be signed in to change notification settings - Fork 3
Add new property to PullRequest ("merged" for forgejo compability) #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,7 +63,7 @@ jobs: | |
| HEADER="repository name,author name,author login,author email,date and time,changed files,commit id,branch" | ||
| ;; | ||
| --pull_requests) | ||
| HEADER="repository name,title,id,state,commit into,commit from,created at,creator name,creator login,creator email,changed files,comment body,comment created at,comment author name,comment author login,comment author email,merger name,merger login,merger email,source branch,target branch,assignee story,related issues,labels,milestone" | ||
| HEADER="repository name,title,id,state,commit into,commit from,created at,creator name,creator login,creator email,changed files,comment body,comment created at,comment author name,comment author login,comment author email,merger name,merger login,merger email,source branch,target branch,assignee story,related issues,labels,milestone,merged" | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. В коде добавлен новый заголовок для комментариев, но в новой версии файла нет указания на это. #ai-review-inline |
||
| ;; | ||
| --issues) | ||
| HEADER="repository name,number,title,state,task,created at,creator name,creator login,creator email,closer name,closer login,closer email,closed at,comment body,comment created at,comment author name,comment author login,comment author email,assignee story,connected pull requests,labels,milestone" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,7 +63,7 @@ jobs: | |
| HEADER="repository name,author name,author login,author email,date and time,changed files,commit id,branch" | ||
| ;; | ||
| --pull_requests) | ||
| HEADER="repository name,title,id,state,commit into,commit from,created at,creator name,creator login,creator email,changed files,comment body,comment created at,comment author name,comment author login,comment author email,merger name,merger login,merger email,source branch,target branch,assignee story,related issues,labels,milestone" | ||
| HEADER="repository name,title,id,state,commit into,commit from,created at,creator name,creator login,creator email,changed files,comment body,comment created at,comment author name,comment author login,comment author email,merger name,merger login,merger email,source branch,target branch,assignee story,related issues,labels,milestone,merged" | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. В коде была удалена строка с заголовком комментария, но в новой версии файла она не обновлена. #ai-review-inline |
||
| ;; | ||
| --issues) | ||
| HEADER="repository name,number,title,state,task,created at,creator name,creator login,creator email,closer name,closer login,closer email,closed at,comment body,comment created at,comment author name,comment author login,comment author email,assignee story,connected pull requests,labels,milestone" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -132,15 +132,23 @@ def get_pull_requests(self, repo: Repository) -> list[PullRequest]: | |
| base_label=p.base.ref, | ||
| head_ref=p.head.ref, | ||
| base_ref=p.base.ref, | ||
| merged_by=self.get_user_data(p.merged_by) if p.merged_by else None, | ||
| files=[], # TODO если возможно | ||
| issue_url=None, # TODO если возможно | ||
| merged_by=self.get_user_data(self.get_pull_request(repo, p.number).merged_by) if p.merged else None, | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Удалены строки, содержащие устаревшие поля merged_by, files и issue_url. #ai-review-inline
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Добавлены строки с новыми полями merged_by и issue_url. #ai-review-inline |
||
| # TODO: merged_by always empty in result of repo_list_pull_requests | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Добавлена заглушка TODO для улучшения кода в будущем. #ai-review-inline |
||
| # (but merged and merged_at are usable) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Добавлена заглушка TODO для улучшения кода в будущем. #ai-review-inline |
||
| merged=p.merged, | ||
| files=[], # TODO нужен отдельный запрос на /repos/{owner}/{repo}/pulls/{index}/files, | ||
| # иначе есть только кол-во измененных файлов в changed_files | ||
| issue_url=None, # TODO если возможно - пока не нашел | ||
| labels=[label.name for label in p.labels] if p.labels else [], | ||
| milestone=p.milestone.title if p.milestone else None, | ||
| ) | ||
| for p in pulls | ||
| ] | ||
|
|
||
| @log_exceptions(default_return={}, message="Failed to get pull request data from Forgejo") | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Добавлен метод get_pull_request для получения данных о Pull Request. #ai-review-inline |
||
| def get_pull_request(self, repo: Repository, pr_index: int) -> PullRequest: | ||
| return self.client.repository.repo_get_pull_request(owner=repo.owner.login, repo=repo.name, index=pr_index) | ||
|
|
||
| @log_exceptions(default_return=[], message="Failed to get branches from Forgejo") | ||
| def get_branches(self, repo: Repository) -> list[Branch]: | ||
| branches = self.client.repository.repo_list_branches( | ||
|
|
@@ -235,7 +243,11 @@ def get_comments(self, repo, obj) -> list[Comment]: | |
| elif isinstance(obj, PullRequest): | ||
| comments = self.client.repository.repo_get_pull_review_comments( | ||
| repo.owner.login, repo.name, obj._id, 100000 | ||
| ) # нет id комментария | ||
| ) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Изменено местоположение комментария, теперь он находится после запроса get_pull_review_comments. #ai-review-inline |
||
| # нет id комментария - сейчас не работает, т.к. требуется ID ревью - нужно сначала получить \ | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Добавлен комментарий о том, что сейчас не работает из-за отсутствия ID ревью. #ai-review-inline |
||
| # список ревью /repos/{owner}/{repo}/pulls/{index}/reviews | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Добавлен комментарий о необходимости отдельных запросов для получения комментариев и ревью. #ai-review-inline |
||
| # TODO: нужны отдельные запросы для получения комментариев и комментариев ревью #163, \ | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Упомянуты поля comments и review_comments в сущности PullRequest. #ai-review-inline |
||
| # в основной сущности PullRequest есть поля "comments": int, "review_comments": int | ||
| result = [ | ||
| Comment( | ||
| body=c.body, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,6 +116,7 @@ def get_pull_requests(self, repo: Repository) -> list[PullRequest]: | |
| head_ref=p.head.ref, | ||
| base_ref=p.base.ref, | ||
| merged_by=self.get_user_data(p.merged_by) if p.merged_by else None, | ||
| merged=bool(p.merged_by), | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Добавлен логический флаг 'merged', который должен быть установлен в значение True, если есть автор слияния. #ai-review-inline |
||
| files=[file.filename for file in p.get_files()], | ||
| issue_url=p.issue_url, | ||
| labels=[label.name for label in p.labels], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,6 +175,7 @@ def log_repositories_pr_by_graphql(owner, repo_name, token, csv_name, first_n=10 | |
| if pr["mergedBy"] and "email" in pr["mergedBy"] | ||
| else None | ||
| ), | ||
| merged=pr["mergedBy"] and "name" in pr["mergedBy"], # TODO: refactor? | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Логика условного выражения в 'merged' не соответствует ожиданиям. #ai-review-inline |
||
| source_branch=pr["headRef"]["name"] if pr["headRef"] else None, | ||
| target_branch=pr["baseRef"]["name"] if pr["baseRef"] else None, | ||
| assignee_story=None, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,6 +119,7 @@ def get_info(obj, attr): | |
| merger_name=pull.merged_by.username if pull.merged_by else None, | ||
| merger_login=pull.merged_by.login if pull.merged_by else None, | ||
| merger_email=pull.merged_by.email if pull.merged_by else None, | ||
| merged=pull.merged, | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Добавлен лишний комментарий в коде. #ai-review-inline |
||
| source_branch=pull.head_ref, | ||
| target_branch=pull.base_ref, | ||
| assignee_story=get_assignee_story(pull, client, token, repository), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,3 +28,4 @@ class PullRequestData: | |
| related_issues: str = '' | ||
| labels: str = '' | ||
| milestone: str = '' | ||
| merged: bool = False | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Добавлен логический флаг 'merged', который не имеет смысла в контексте данного класса. #ai-review-inline |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В коде была удалена строка с заголовком комментариев, но в новой версии файла она не обновлена.
#ai-review-inline