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: compare all branch authors when deciding if a branch is modified #21558
Conversation
Hi @Keysox thanks for resubmitting this functionality. Could you describe your confidence about whether the problem which occurred previously has been resolved and how? |
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.
last time it was totally broken, are those issues now resolved?
@rarkins @viceice, the original one used Do you have any suggestions on how to add unit tests? The last PR had them but when I tried a month ago, I wasn't able to this time around since this new approach relied on the branch being pushed, which I wasn't able to figure out how to do with jest. Will poke at it again! |
@Keysox do you have the time to add the requested test? |
Co-authored-by: Rhys Arkins <rhys@arkins.net>
🎉 This PR is included in version 37.26.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
await git.raw([ | ||
'log', | ||
'--pretty=format:%ae', | ||
`origin/${branchName}..origin/${baseBranch}`, |
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.
The syntax here is the wrong way.
This check means "all from baseBranch except those on branchName".
So basically this would return all commits that are on the base but NOT on the renovate-bot.
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.
what would be the right command?
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.
@viceice Either switch the operands
`origin/${branchName}..origin/${baseBranch}`, | |
`origin/${baseBranch}..origin/${branchName}`, |
Or use the explicit
`origin/${branchName}..origin/${baseBranch}`, | |
`origin/${branchName} ^origin/${baseBranch}`, |
Both should show all commits on the branchName (e.g. renovate/dep-abc), but without any commits on the baseBranch (e.g. main).
So if we were to have the following git tree (I hope the mermaid rendering is supported in all browsers):
gitGraph
commit id: "A"
commit id: "B"
commit id: "C"
branch renovate/x
checkout main
commit id: "D"
commit id: "E"
checkout renovate/x
commit id: "X"
Then baseBranch would be main
and branchName would be renovate/x
We'd probably only want to look at the commit X
, but the way this MR was written would return the D and E
Then the result would be:
command | result | |
---|---|---|
main..renovate/x |
X |
✅ |
renovate/x..main |
D, E |
❌ |
renovate/x ^main |
X |
✅ |
main ^renovate/x |
D, E |
❌ |
Of course, if there were some rebasing done in between, it would be a bit different.
Let's say we rebased C, D, E on the main branch (if for whatever reason you were to rebase on main).
Or well, pretty much anything that rewrites history, like someone else force-pushing over someone else's changes.
gitGraph
commit id: "A"
commit id: "B"
branch renovate/x
checkout renovate/x
commit id: "C"
commit id: "X"
checkout main
commit id: "C - rebased"
commit id: "D - rebased"
commit id: "E - rebased"
Then the result would be:
command | result |
---|---|
main..renovate/x |
C, X |
renovate/x..main |
C - rebased, D - rebased, E - rebased |
renovate/x ^main |
C, X |
main ^renovate/x |
C - rebased, D - rebased, E - rebased |
I don't know what the expected behaviour should be in the case the main was force-pushed, but you can at least use these tables as reference if you wanted this feature again 😉
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.
rebase would be an issue now too. I'm not too worried about that. it shouldn't be a normal workflow with renovate. can we detect that?
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 I'll try to create this PR again with proper tests
This just closed all our merge requests in Bitbucket Server. 🥲
|
@rarkins revert again? |
Yeah, renovate is marking all our open MRs as edited/blocked incorrectly as well with this update. |
@mufflon it closed them? Or added a comment? |
Now reverted, please upgrade to 37.26.1 once it's built and available. Sorry for the trouble everyone! |
37.26.1 you mean😸 Thanks for the quick action! 👍🏻 |
Yes, fixed now thanks! |
With the rollback, is there any straightforward way to recover PRs that have been marked in this way, without having to go through and checking each individual box? |
Renovate should treat them as unmodified now, although I'm not sure if it will remove those comments |
OK - as long as the comment itself doesn't have some significance to Renovate. I'll keep an eye on the affected PRs. Thanks @rarkins |
The MRs affected by this issue don't seem to be auto resolving with newer builds. Is anyone seeing anything different? I'm trying to force a rebase now to get some of them unblocked. |
@chezsmithy please copy/paste the logs for one such branch. My expectation is that the comment remains, but that Renovate should be back to its old functionality and consider the branch to be unmodified |
Can confirm this: Renovatebot proceeds to update the PRs. The comment remains, though. |
@rarkins Also seeing what @muffl0n is reporting. The comment remaining was the unexpected part. |
renovatebot#21558) Co-authored-by: Rhys Arkins <rhys@arkins.net>
Changes
Previously, when Renovate tried to determine if a branch was modified before force-pushing, it only looked at the last commit, which can result in losing commit history. This PR changes the behavior to compare all of the commits to the default branch.
Context
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via: