skara icon indicating copy to clipboard operation
skara copied to clipboard

1584: Require re-review of a PR if the target branch changes

Open erikj79 opened this issue 2 years ago • 4 comments

This change improves reviewer handling when the target branch of a PR is changed. Currently this only invalidates a review on GitHub, but not on GitLab. With this change the behavior is made uniform. In addition to this, the following new behavior is added.

  1. When the target branch of a PR is changed, any existing reviews in the Reviewers list will be flagged as "Re-review required (review applies to pull request targeting )" to make what happened clearer.
  2. If the target branch of a PR is changed back to a previously targeted branch, any reviews made against that branch may now become valid again (if all other requirements are met).

Note that changes to and from pr/X branches are ignored, just like before.

PullRequest::reviews is no longer specifying the order of reviews returned. This order was actually not consistent between implementations and I would rather we use explicit sorts when needed instead of assuming an order.

I'm not really happy with the placement of the new static method calculateReviewTargetRefs, but I couldn't really find a better location, and I really wanted to share this between different PullRequest implementations. I think the correct solution would be to introduce an AbstractPullRequest common super class, but I didn't want to do this for a single method.

I have verified this with the new and modified tests, as well as by running against the playground repo(s).


Progress

  • [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace

Issue

  • SKARA-1584: Require re-review of a PR if the target branch changes

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/skara pull/1383/head:pull/1383
$ git checkout pull/1383

Update a local copy of the PR:
$ git checkout pull/1383
$ git pull https://git.openjdk.org/skara pull/1383/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1383

View PR using the GUI difftool:
$ git pr show -t 1383

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/skara/pull/1383.diff

erikj79 avatar Sep 23 '22 17:09 erikj79

:wave: Welcome back erikj! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

bridgekeeper[bot] avatar Sep 23 '22 17:09 bridgekeeper[bot]

@erikj79 this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout SKARA-1584-rereview-targetref
git fetch https://git.openjdk.org/skara master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

openjdk[bot] avatar Sep 23 '22 17:09 openjdk[bot]

Webrevs

mlbridge[bot] avatar Sep 23 '22 17:09 mlbridge[bot]

I believe the tests are failing due to intermittent failures in the poller. That should be fixed by https://github.com/openjdk/skara/pull/1380.

erikj79 avatar Oct 04 '22 18:10 erikj79

@erikj79 This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

:mag: One or more changes in this pull request modifies files in areas of the source code that often require two reviewers. Please consider if this is the case for this pull request, and if so, await a second reviewer to approve this pull request before you integrate it.

After integration, the commit message for the final commit will be:

1584: Require re-review of a PR if the target branch changes

Reviewed-by: ehelin

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

openjdk[bot] avatar Oct 07 '22 12:10 openjdk[bot]

I don't really mind the static method, in general I prefer that over an abstract base class. I personally think that an abstract base class makes it so much harder to follow the control flow in sub-classes, whereas now it is very clear in GitLabMergeRequest and GitHubPullRequest how the static helper method is used.

edvbld avatar Oct 07 '22 12:10 edvbld

/integrate

erikj79 avatar Oct 07 '22 20:10 erikj79

Going to push as commit d6c5a1a84d8f80ccf6d39132080cb52982fab854. Since your change was applied there have been 2 commits pushed to the master branch:

  • 55084b1bc6ff1d1d3261c19347a6eb3ec120104d: 1618: CSR bot failed to update PR when CSR was approved
  • 68b4f58708ef4c113a81ce38455192a692f4c86b: 1626: 8-pool records not consumed by openjdk8uX fixversions

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Oct 07 '22 20:10 openjdk[bot]

@erikj79 Pushed as commit d6c5a1a84d8f80ccf6d39132080cb52982fab854.

:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

openjdk[bot] avatar Oct 07 '22 20:10 openjdk[bot]