Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the 'Pull Requests' tab in the job repository #269

Merged
merged 1 commit into from
Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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