-
Notifications
You must be signed in to change notification settings - Fork 66
Feat/forgejo/projects #893
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
Feat/forgejo/projects #893
Conversation
Build succeeded. ✔️ pre-commit SUCCESS in 2m 50s |
Build succeeded. ✔️ pre-commit SUCCESS in 2m 46s |
Build succeeded. ✔️ pre-commit SUCCESS in 2m 50s |
Build succeeded. ✔️ pre-commit SUCCESS in 3m 41s |
d538c38
to
c3ab17a
Compare
Build failed. ❌ pre-commit FAILURE in 3m 41s |
c3ab17a
to
7d641ad
Compare
Build failed. ❌ pre-commit FAILURE in 3m 59s |
7d641ad
to
6629cf7
Compare
Build failed. ✔️ pre-commit SUCCESS in 3m 43s |
a41ffb1
to
b8df2cc
Compare
Build failed. ✔️ pre-commit SUCCESS in 3m 43s |
Build failed. ✔️ pre-commit SUCCESS in 3m 53s |
15f8a7b
to
17dd105
Compare
Build failed. ✔️ pre-commit SUCCESS in 3m 41s |
122a5e7
to
00632be
Compare
Build succeeded. ✔️ pre-commit SUCCESS in 3m 37s |
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.
thanks for all the improvements along the way, LGTM 🚀
# [NOTE] Is there any reason we fetch all commits, instead of using the | ||
# head commit on the PR? | ||
# commit = self.get_all_commits()[-1] | ||
commit = self.head_commit |
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.
maybe the head_commit
wasn't implemented when implementing this?
@@ -48,9 +49,16 @@ def __init__( | |||
super().__init__(repo, service, namespace) | |||
8000 | self._forgejo_repo = forgejo_repo | ||
|
|||
@property | |||
def api(self) -> RepositoryClient: | |||
"""Returns a `RepositoryClient` from pyforgejo. Helper to save some |
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.
👍
)().content | ||
)() | ||
|
||
# [NOTE] If you touch this, good luck, have fun… |
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.
😅
Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
There's a specialization in the API when creating new projects that differentiates between: • projects being created in the user's namespace • projects being created in different namespace, i.e., organization This differentiation, however, disappears when you ‹GET› existing repos… Therefore handle this consistently with other forges, i.e., when creating new projects, take in account the possibility of ‹namespace› being set to ‹None›, but when fetching the repository, expect the ‹namespace› to be set to the correct value (org or user). Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
• Move reversal of the comments to the method that fetches comments from the git-forge API · Allows to postpone unnecessary API calls when only few of the first comments (from either end of the ordering) need to be fetched · Also removes the reversal logic from the filtering itself, which should be independant from the filtering • Accept ‹Union[list[Comment], Iterable[Comment]]› from the related methods • Adjust filtering / search methods to accomodate the aforementioned changes • Fix tests Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Based on the discussion we had during the arch about ogr pagination, let's start with relaxing the abstract interface to allow returning iterables instead of full lists. Signed-off-by: Matej Focko <mfocko@redhat.com>
Based on the code, it doesn't make much sense to fetch »all« commits to just take the last one, i.e., the head commit of the PR. Therefore switch to using the head commit property directly instead of list of all commits that's not even used. Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
After running ruff: warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `pyproject.toml`: - 'ignore' -> 'lint.ignore' - 'select' -> 'lint.select' Therefore switch to those new options. Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Closes packit#877 Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Missed the router in the path. Signed-off-by: Matej Focko <mfocko@redhat.com>
Create a property for accessing the repository client from the ForgejoProject to simplify. Signed-off-by: Matej Focko <mfocko@redhat.com>
As there is a lot of similar code used just for the pagination of the Forgejo API, it makes sense to factor it out to its own function that handles the nitty-gritty technical annoying details. Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Introduce a helper that allows injecting specific parameters to each call to the API to reduce the copy-paste. Signed-off-by: Matej Focko <mfocko@redhat.com>
Contents is base64-encoded, therefore it needs to be decoded back to the original text (in majority of cases…). Signed-off-by: Matej Focko <mfocko@redhat.com>
As part of the future pagination changes, make ‹filter_paths› work with iterables instead of lists. Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
I shall go »«, ‹› in strings… Signed-off-by: Matej Focko <mfocko@redhat.com>
Based on the outcome of Thursday's (2025/03/27) arch discussion regarding this issue: • Warn when using the ‹ForgejoProject.get_files()› as the fix for the API spec issue has not been released yet. • Skip the test, so that the CI is happy. Related to https://codeberg.org/forgejo/forgejo/issues/7328 Related to https://codeberg.org/harabat/pyforgejo/issues/11 To be removed after https://codeberg.org/harabat/pyforgejo/pulls/12 Tracking issue: packit#907 Signed-off-by: Matej Focko <mfocko@redhat.com>
00632be
to
484bf23
Compare
Build succeeded. ✔️ pre-commit SUCCESS in 3m 46s |
Build succeeded (gate pipeline). ✔️ pre-commit SUCCESS in 3m 44s |
9c5d2d5
into
packit:main
TODO:
packit/packit.dev
.ForgejoProject.get_file_content
returns base64-encoded contentsForgejoProject.get_files
needs to be implemented manually as in Pagure…owner, repo
)Fixes #877