-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Retarget Pulls Based on Pulls on Merge #18478
Conversation
23cfa97
to
10e8126
Compare
The PRs should be rebased when base branch updated but not when merging or deleting the branch. |
I think I've used wrong words. This PR is about changing PR's target branch. I will change names. |
10e8126
to
4bdd0ee
Compare
I've updated descritpion and names inside PR. Hopefully it's more clear now... |
Any chances to discuss possibility of such change ? Other git systems are using such approach and it is really usefull and it breaks nothing... And changes are very small. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions. |
Chiming in since a stale label got added. Having PRs get their base branch updated when a PR for the base branch is merged like this would be great. My team previously used Bitbucket's equivalent feature often for landing complex features in multiple stages. |
I think Gitea should not change the target branch automatically but it could be changed manually. |
Currently you're loosing all PRs discussions in such case. Can it be optional setting for gitea behaviour ? |
Usually you and reviewer's don't care about 'child' branches. And 'option' (I will make PR for option) for automatic target branch change may be useful. Also this PR will have no any significant changes to codebase. |
How would the workflow for manually changing the target branch look? I can think of two ways currently that both have problems: Example PRs: main <- feature1 Manual Scenario 1, merge oldest to newest:
It's too easy to delete feature1 at the wrong time and permanently close the feature2 PR by accident. (#18478) Manual Scenario 2, merge newest to oldest:
The diff change in step 2 adds a bunch of noise to the PR, which makes it more difficult to understand the PR after. Auto-Update Scenario, merge oldest to newest:In comparison, this is how Bitbucket Server works:
If using a rebase or rebase-and-merge strategy, the history ends up linear with any of these scenarios. Why should Gitea not update PR base branches automatically? |
4bdd0ee
to
91de000
Compare
I've updated PR according to upstream. Any suggestion in what section to add flag for enabling/disabling this feature ? |
One more PR update - make an option for retarget. |
hmm I think we can add some nice integration tests for mentioned cases example: gitea/integrations/git_test.go Lines 487 to 498 in 9efa471
.... |
Does option is really needed for this? I mean is there a use case where re-targeting would be undesirable? |
I personaly would not mind if it always try retargeting ... |
Maybe manually allowing to retarget pulls base branch even if base branch(or base repository) was deleted is better or it's the first step of this auto retarget. |
@kvaster in any case - we need integration tests, if you need help just tell us (here or chat via discord/matrix) |
Will try to do this myself today and will get back tomorrow if will need any help. |
Hello, is this still an ongoing PR or has it been abandoned? |
Actually we're using this patch already for long time, but it was difficult for me to write tests... However I can do necessary changes to PR itself... |
0422e6b
to
ff95805
Compare
ff95805
to
c7f03bb
Compare
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #18478 +/- ##
========================================
Coverage 47.14% 47.15%
========================================
Files 1149 1155 +6
Lines 151446 152431 +985
========================================
+ Hits 71397 71872 +475
- Misses 71611 72071 +460
- Partials 8438 8488 +50
... and 47 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
365ad39
to
1e270a4
Compare
Thanks for this PR - sorry it's taking so long to get in. A few thoughts:
|
Telling the truth, I was not aware about retargeting to another repository, but now I think it might be also usefull. |
It was started something long ago. I think I've not prepare code for retargeting to new repository cause |
Closing in favor of #28539. If there is a reason to, feel free to reopen. |
Sometimes you need to work on feature which depends on another feature which is in a review process. In this case you may create PR based on that feature insteadof main branch. Currently such PR will be closed without possibility to reopen in case parent feature will be approved, merged and it's branch will be deleted. Automatic target branch change will make life a lot easier in such cases. Github and Bitbucket behaves in such way.
Example:
PR1: main <- feature 1
PR2: feature <- feature2
Currently merging PR1 and deleteing it's branch will lead to PR2 closed without possibility to reopen without loosing it's review histort.
With this change PR2 will change it's target branch to main (PR2: main <- feature2) after PR1 will be merged and it's branch will be deleted.
fixes #18408