Skip to content

Commit

Permalink
Add the 'Pull Requests' tab in the job repository (#269)
Browse files Browse the repository at this point in the history
Part of [story#18320](https://tuleap.net/plugins/tracker/?aid=18320) native support of pull requests in tuleap branch source jenkins plugin

Now for each job repository, you should see the `Pull Requests` tab next
to the `Branches` tab

To see the new tab, you should at least rescan the Tuleap project

Co-authored-by: Clarck Robinson <clarck.robinson@enalean.com>
  • Loading branch information
robinsoc and Clarck Robinson authored Aug 20, 2021
1 parent 5087d86 commit c5a7cc5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import jenkins.scm.api.*;
import jenkins.scm.api.trait.SCMSourceRequest;
import jenkins.scm.api.trait.SCMSourceTrait;
import jenkins.scm.impl.ChangeRequestSCMHeadCategory;
import jenkins.scm.impl.UncategorizedSCMHeadCategory;
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.tuleap_git_branch_source.config.TuleapSCMFileSystem;
import org.jenkinsci.plugins.tuleap_git_branch_source.helpers.TuleapApiRetriever;
Expand Down Expand Up @@ -509,6 +511,15 @@ public ListBoxModel doFillRepositoryPathItems(@CheckForNull @AncestorInPath Item
}
return result;
}

@NonNull
@Override
protected SCMHeadCategory[] createCategories(){
return new SCMHeadCategory[]{
UncategorizedSCMHeadCategory.DEFAULT,
new ChangeRequestSCMHeadCategory(Messages._TuleapSCMSource_ChangeRequestCategory())
};
}
}

private static class OFWitness implements SCMSourceRequest.Witness {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import jenkins.scm.api.SCMSource;
import jenkins.scm.api.mixin.ChangeRequestSCMHead2;
import jenkins.scm.api.trait.*;
import jenkins.scm.impl.ChangeRequestSCMHeadCategory;
import jenkins.scm.impl.trait.Discovery;
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.tuleap_git_branch_source.*;
Expand Down Expand Up @@ -37,7 +38,7 @@ protected void decorateContext(SCMSourceContext<?, ?> context) {
*/
@Override
public boolean includeCategory(@NonNull SCMHeadCategory category) {
return category.isUncategorized();
return category instanceof ChangeRequestSCMHeadCategory;
}

@Symbol("tuleapForkPullRequestDiscovery")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import jenkins.scm.api.*;
import jenkins.scm.api.mixin.ChangeRequestSCMHead2;
import jenkins.scm.api.trait.*;
import jenkins.scm.impl.ChangeRequestSCMHeadCategory;
import jenkins.scm.impl.trait.Discovery;
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.tuleap_git_branch_source.Messages;
Expand Down Expand Up @@ -34,7 +35,7 @@ protected void decorateContext(SCMSourceContext<?, ?> context) {
*/
@Override
public boolean includeCategory(@NonNull SCMHeadCategory category) {
return category.isUncategorized();
return category instanceof ChangeRequestSCMHeadCategory;
}

@Symbol("tuleapPullRequestDiscovery")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ TuleapForkPullRequestDiscoveryTrait.displayName=Tuleap Pull Requests from fork a
TuleapCommitNotificationTrait.displayName=Notify build status to Tuleap

WildcardSCMSourceFilterTrait.displayName=Filter repositories by name (wildcards)

TuleapSCMSource.ChangeRequestCategory=Pull Requests

0 comments on commit c5a7cc5

Please sign in to comment.