-
Notifications
You must be signed in to change notification settings - Fork 55
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
Revisiting API for creating PRs #412
Comments
Current behaviourpull request from one branch to another on the upstream projectupstream_pr = upstream.create_pr(
title="example title",
body="pr description",
target_branch="master",
source_branch="my-patch-on-upstream"
) pull request from fork to the upstream projectupstream_pr = my_fork.create_pr(
title="example title",
body="pr description",
target_branch="master",
source_branch="my-patch-on-my-fork"
) pull request from one branch on my fork to another branch of my forkpr_on_my_fork = my_fork.create_pr(
title="example title",
body="pr description",
target_branch="my-wip",
source_branch="my-patch",
fork_username="mfocko" # or you can get username from service
) pull request from one fork to anotherpr_on_other_fork = my_fork.create_pr(
title="example title",
body="pr description",
target_branch="patch-of-other-user",
source_branch="my-patch-for-other-user",
fork_username="lachmanfrantisek"
) SummaryThe way you can use Examples above call Has a problem with forks of forks! Created PRs keep back-reference to the project they've been called on, even though they may not be created on that project. |
Option A - Separate functions
pull request from one branch to another on the upstream projectupstream_pr = upstream.create_pr(
title="example title",
body="pr description",
target_branch="master",
source_branch="my-patch-on-upstream"
) pull request from fork to the upstream projectupstream_pr = my_fork.create_pr_to_upstream(
title="example title",
body="pr description",
target_branch="master",
source_branch="my-patch-on-my-fork"
) pull request from one branch on my fork to another branch of my forkpr_on_my_fork = my_fork.create_pr(
title="example title",
body="pr description",
target_branch="my-wip",
source_branch="my-patch"
) pull request from one fork to anotherpr_on_other_fork = fork_of_different_user.create_pr(
title="example title",
body="pr description",
target_branch="patch-of-other-user",
source_branch="mfocko:my-patch", # alternatively f"{username_from_service}:my-patch"
) SummaryThis approach would allow to keep flexibility of creating PRs against the upstream, but with explicitly named function, which would mean there's no monkey business going in the background implicitly. For PR from one fork to another fork there is also a possibility of:
|
Option B - PRs are created on the project the method is called onpull request from one branch to another on the upstream projectupstream_pr = upstream.create_pr(
title="example title",
body="pr description",
target_branch="master",
source_branch="my-patch-on-upstream"
) pull request from fork to the upstream projectupstream_pr = upstream.create_pr( # alternatively `my_fork.parent.create_pr`
title="example title",
body="pr description",
target_branch="master",
source_branch="my-patch-on-my-fork",
fork_username="mfocko" # alternatively call to service to acquire username
) pull request from one branch on my fork to another branch of my forkpr_on_my_fork = my_fork.create_pr(
title="example title",
body="pr description",
target_branch="my-wip",
source_branch="my-patch"
) pull request from one fork to anotherpr_on_other_fork = fork_of_different_user.create_pr(
title="example title",
body="pr description",
target_branch="patch-of-other-user",
source_branch="my-patch",
fork_username="mfocko"
) SummaryThere could be problem with handling
Traversing through forks resolves problem with renamed forks. However On the other hand, this approach makes it explicit where the PR is being created. |
Option C - call on projects you're pulling fromBasically current behaviour, but wouldn't allow implicit PR to parent if called on fork.
Could be same as option A, but other way around. (Requires multiple API calls, since we need to get internal projects.) What about renaming? (Seems like github/gitlab uses username to resolve the fork and branch) |
Summary
|
Thank you for such a thorough write-up. I personally like B |
@mfocko thank you! |
Under the hood I would imagine something like this:
This function could live outside of any class. Would be explicit. Classes could have Would something like this work, or it's total non-sense? |
@saisankargochhayat @cverna @thrix (and also @packit-service/the-packit-team) Since you use OGR, you might be interested in this issue and the proposed way of creating pull-requests. (Or just be informed that we are thinking about changing the API a little.) Can you please take a look at this proposal and use 👍 and 👎 reactions on the previous comments with the proposals. Thanks in advance! |
Yes, that makes sense to have this under the hood. Also, the defaults are here much clearer. But still, we probably want to have some method(s) in the project class. |
This issue has been marked as stale because it hasn't seen any Stale issues are closed after 14 days, unless the label is removed This is done in order to ensure that open issues are still relevant. Thank you for your contribution! 🦄 🚀 🤖 (Note: issues labeled with pinned, security, bug or EPIC are |
This issue has been marked as stale because it hasn't seen any Stale issues are closed after 14 days, unless the label is removed This is done in order to ensure that open issues are still relevant. Thank you for your contribution! 🦄 🚀 🤖 (Note: issues labeled with pinned, security, bug or EPIC are |
Looks like we have two votes for the second option and noone else cares about that. @mfocko can we start working on this? So:
|
@lachmanfrantisek sure |
This issue has been marked as stale because it hasn't seen any Stale issues are closed after 14 days, unless the label is removed This is done in order to ensure that open issues are still relevant. Thank you for your contribution! 🦄 🚀 🤖 (Note: issues labeled with pinned or EPIC are |
This issue has been marked as stale because it hasn't seen any Stale issues are closed after 14 days, unless the label is removed This is done in order to ensure that open issues are still relevant. Thank you for your contribution! 🦄 🚀 🤖 (Note: issues labeled with pinned or EPIC are |
@mfocko Do you have some time to take a look? (Some Friday work?..;-) |
This issue has been marked as stale because it hasn't seen any Stale issues are closed after 14 days, unless the label is removed This is done in order to ensure that open issues are still relevant. Thank you for your contribution! 🦄 🚀 🤖 (Note: issues labeled with pinned or EPIC are |
This issue has been marked as stale because it hasn't seen any Stale issues are closed after 14 days, unless the label is removed This is done in order to ensure that open issues are still relevant. Thank you for your contribution! 🦄 🚀 🤖 (Note: issues labeled with pinned or EPIC are |
It would be really nice to finish this work. |
This issue has been marked as stale because it hasn't seen any Stale issues are closed after 14 days, unless the label is removed This is done in order to ensure that open issues are still relevant. Thank you for your contribution! 🦄 🚀 🤖 (Note: issues labeled with pinned or EPIC are |
🙄 |
This issue has been marked as stale because it hasn't seen any Stale issues are closed after 14 days, unless the label is removed This is done in order to ensure that open issues are still relevant. Thank you for your contribution! 🦄 🚀 🤖 (Note: issues labeled with pinned or EPIC are |
Another try?..;) |
Friday? for real now? :D I've also made changes in packit(|-service), so we should be able to remove the deprecated functions too… unless there are dependencies in stream and validation… |
This issue has been marked as stale because it hasn't seen any Stale issues are closed after 14 days, unless the label is removed This is done in order to ensure that open issues are still relevant. Thank you for your contribution! 🦄 🚀 🤖 (Note: issues labeled with pinned or EPIC are |
Current API appears to be fully functional and sufficiently covered by tests for GitHub and Pagure.
Services
GitHub + GitLab
Pagure
Current implementation
Example objects used later
The text was updated successfully, but these errors were encountered: