RFR: 2084: Add a `/branch` command similar to `/tag` to create a new branch from a commit [v2]

Erik Joelsson erikj at openjdk.org
Mon Nov 6 14:47:59 UTC 2023


On Mon, 6 Nov 2023 14:27:30 GMT, Erik Duveblad <ehelin at openjdk.org> wrote:

>> Hi all,
>> 
>> please review this patch that adds a `/branch` commit command. The `/branch` commit command allows an integrator to create a _new_ branch in a repository by adding the comment `/branch <name>` on a commit's web page. The command will check that no branch with the given name exists (i.e. it won't update a branch with that name to that commit).
>> 
>> The implementation is very similar to the `/tag` command, but I don't think it makes sense to try to share code between them. They are both only around 60 lines of code, so trying to share code won't give us much.
>> 
>> I also added a couple of new unit tests.
>> 
>> Thanks,
>> Erik
>
> Erik Duveblad has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Reviewer feedback

Marked as reviewed by erikj (Lead).

bots/pr/src/main/java/org/openjdk/skara/bots/pr/BranchCommand.java line 123:

> 121:             var jcheckConf = JCheckConfiguration.from(localRepo, commit.hash());
> 122:             var branchPattern = jcheckConf.isPresent() ? jcheckConf.get().repository().branches() : null;
> 123:             if (branchPattern != null && !branchName.matches(branchPattern)) {

Can keep this functional and null free if you want:
Suggestion:

            var branchPattern = jcheckConf.map(c -> c.repository().branches());
            if (branchPattern.isPresent() && !branchName.matches(branchPattern.get())) {

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

PR Review: https://git.openjdk.org/skara/pull/1583#pullrequestreview-1715381190
PR Review Comment: https://git.openjdk.org/skara/pull/1583#discussion_r1383451204


More information about the skara-dev mailing list