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

Erik Joelsson erikj at openjdk.org
Thu Jul 28 19:46:01 UTC 2022

On Thu, 28 Jul 2022 13:04:07 GMT, Guoxiong Li <gli at openjdk.org> wrote:

>> forge/src/main/java/org/openjdk/skara/forge/PullRequest.java line 189:
>>> 187: 
>>> 188:     default Optional<Hash> findIntegratedCommitHash(List<String> userIds) {
>>> 189:         Pattern pushedPattern = Pattern.compile("Pushed as commit ([a-f0-9]{40})\\.");
>> If you are moving this pattern from the bots modules to this class, then I think you should also move the comment logic from IntegrateCommand here so that both the creation and parsing of this kind of comment is handled at the same level. It seems bad to have PullRequest know about what special comments the IntegrateCommand happens to add.
> What about adding a parameter like `Pattern commitComment` to the method `findIntegratedCommitHash`?

The drawback of that is that we then need to have a copy of the pattern everywhere we call the method. I think it's better to have something like a static method on PullRequest like `String commitHashMessage(Hash)`, which takes a hash and returns a String with the formatted message. IntegrateCommand can use that to format the relevant part of the comment.


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

More information about the skara-dev mailing list