8000 Feat/forgejo/projects by mfocko · Pull Request #893 · packit/ogr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged

Conversation

mfocko
Copy link
Member
@mfocko mfocko commented Mar 4, 2025

TODO:

  • Write new tests or update the old ones to cover new functionality.
  • Update doc-strings where appropriate.
  • Update or write new documentation in packit/packit.dev.
  • ForgejoProject.get_file_content returns base64-encoded contents
  • ForgejoProject.get_files needs to be implemented manually as in Pagure…
  • Improve the partial calls (that reuse owner, repo)

Fixes #877

@mfocko mfocko self-assigned this Mar 4, 2025
@mfocko mfocko marked this pull request as draft March 4, 2025 15:59
Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

@mfocko mfocko force-pushed the feat/forgejo/projects branch from d538c38 to c3ab17a Compare March 12, 2025 07:52
Copy link
Contributor

@mfocko mfocko force-pushed the feat/forgejo/projects branch from c3ab17a to 7d641ad Compare March 17, 2025 13:46
Copy link
Contributor

@mfocko mfocko force-pushed the feat/forgejo/projects branch from 7d641ad to 6629cf7 Compare March 21, 2025 10:35
Copy link
Contributor

@mfocko mfocko force-pushed the feat/forgejo/projects branch from a41ffb1 to b8df2cc Compare March 21, 2025 11:50
Copy link
Contributor

Copy link
Contributor

@mfocko mfocko linked an issue Mar 25, 2025 that may be closed by this pull request
3 tasks
@mfocko mfocko force-pushed the feat/forgejo/projects branch from 15f8a7b to 17dd105 Compare March 26, 2025 10:13
@mfocko mfocko marked this pull request as ready for review March 26, 2025 10:14
Copy link
Contributor

@mfocko mfocko force-pushed the feat/forgejo/projects branch 2 times, most recently from 122a5e7 to 00632be Compare March 27, 2025 13:14
Copy link
Contributor

Copy link
Member
@lbarcziova lbarcziova left a 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 🚀

Comment on lines +82 to +85
# [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
Copy link
Member

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?

8000
@@ -48,9 +49,16 @@ def __init__(
super().__init__(repo, service, namespace)
self._forgejo_repo = forgejo_repo

@property
def api(self) -> RepositoryClient:
"""Returns a `RepositoryClient` from pyforgejo. Helper to save some
Copy link
Member

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…
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😅

mfocko added 3 commits April 1, 2025 15:30
Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
Signed-off-by: Matej Focko <mfocko@redhat.com>
mfocko added 22 commits April 1, 2025 15:30
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>
@mfocko mfocko force-pushed the feat/forgejo/projects branch from 00632be to 484bf23 Compare April 1, 2025 13:33
Copy link
Contributor

@mfocko mfocko added the mergeit Merge via Zuul label Apr 2, 2025
Copy link
Contributor

Build succeeded (gate pipeline).
https://softwarefactory-project.io/zuul/t/packit-service/buildset/eb731464cee3486ba0b6ecad3ac19383

✔️ pre-commit SUCCESS in 3m 44s

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 9c5d2d5 into packit:main Apr 2, 2025
26 of 35 checks passed
@mfocko mfocko mentioned this pull request Apr 3, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mergeit Merge via Zuul
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement support for Forgejo projects
2 participants
0