RFR: 1495: /backport on PRs instead of commits should inform of proper usage [v2]

Guoxiong Li gli at openjdk.org
Sat Jul 9 16:29:24 UTC 2022


> Hi all,
> 
> This patch mainly solves the issue described at SKARA-1495 which makes the `backport` command be valid in a pull request which has been integrated.
> 
> But in detail, this patch has the following feature or solves the following issues:
> 
> - Currently, the commands of the pull request and the commands of the commit are not related and can't be known from each other. So when we use the commit commands, such as `tag`, in the pull request, the bot replies `Unknown command tag`. Actually, the bot should replies the message like `The command tag can not be used in pull requests.  Please try to use this command on the commit`. The change is mainly at method `CommandExtractor::extractCommands`.
> - Many places of the code use a duplicated method, named `resultingCommitHash`, this method could be put into class `PullRequest` to avoid the duplication. I refactor it in this patch.
> - Now the `backport` command can not be used in pull requests. I revise the logic to let it available in a pull request which has been integrated, mainly removing the overrided method `allowedInPullRequest` of the class `BackportCommand`.
> - The reason that these issues are not found before is that we hadn't tested all the branches of the code, especially the branches in methods `PullRequestCommandWorkItem::processCommand` and `CommitCommandWorkItem::processCommand`. So I add more test cases to test almost all the branches. And if the branch can't be tested, I add a comment to explain it.
> 
> Although it seems that many features are not related to SKARA-1495, I put them together as an enhance of the PullRequestBot.
> 
> Best Regards,
> -- Guoxiong

Guoxiong Li has updated the pull request incrementally with one additional commit since the last revision:

  Fix NPE.

-------------

Changes:
  - all: https://git.openjdk.org/skara/pull/1341/files
  - new: https://git.openjdk.org/skara/pull/1341/files/2a1c4908..49d5ef51

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=skara&pr=1341&range=01
 - incr: https://webrevs.openjdk.org/?repo=skara&pr=1341&range=00-01

  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/skara/pull/1341.diff
  Fetch: git fetch https://git.openjdk.org/skara pull/1341/head:pull/1341

PR: https://git.openjdk.org/skara/pull/1341


More information about the skara-dev mailing list