@Deprecated @Override @Restricted(DoNotUse.class) @RestrictedSince("3.4.0") protected List<RefSpec> getRefSpecs() { return new GitSCMSourceContext<>(null, SCMHeadObserver.none()).withTraits(traits).asRefSpecs(); }
private void observe(SCMSourceCriteria criteria, @Nonnull SCMHeadObserver observer, GitLabSCMHead head, TaskListener listener) throws IOException, InterruptedException { if (criteria == null || matches(criteria, head, listener)) { observer.observe(head, head.getRevision()); } }
? Collections.unmodifiableSet(EnumSet.copyOf(context.forkPRStrategies())) : Collections.<ChangeRequestCheckoutStrategy>emptySet(); Set<SCMHead> includes = context.observer().getIncludes(); if (includes != null) { Set<Long> pullRequestNumbers = new HashSet<>(includes.size());
observer.observe(head, new SCMRevisionImpl(head, branchRevision)); if (!observer.isObserving()) { return;
@Override protected SCMRevision retrieve(@NonNull String thingName, @NonNull TaskListener listener) throws IOException, InterruptedException { SCMHeadObserver.Named baptist = SCMHeadObserver.named(thingName); retrieve(null, baptist, null, listener); return baptist.result(); }
/** * {@inheritDoc} */ @Override protected boolean isCategoryEnabled(@NonNull SCMHeadCategory category) { if (category instanceof TagSCMHeadCategory) { return new GitSCMSourceContext<>(null, SCMHeadObserver.none()).withTraits(getTraits()).wantTags(); } return super.isCategoryEnabled(category); }
public void observe(@Nonnull GitHubCause<?> cause) { try { GitHubSCMRevision scmRevision = cause.createSCMRevision(source.getId()); if (!cause.isSkip()) { forceScheduling(scmRevision); } getObserver().observe(scmRevision.getHead(), scmRevision); } catch (IOException | InterruptedException e) { e.printStackTrace(listener.getLogger()); } }
? Collections.unmodifiableSet(EnumSet.copyOf(context.forkPRStrategies())) : Collections.<ChangeRequestCheckoutStrategy>emptySet(); Set<SCMHead> includes = context.observer().getIncludes(); if (includes != null) { Set<Integer> pullRequestNumbers = new HashSet<>(includes.size());
if (new GiteaSCMSourceContext(null, SCMHeadObserver.none()) .withTraits(source.getTraits()) .notificationsDisabled()) {
GitSCMSource git = (GitSCMSource) source; GitSCMSourceContext<?,?> ctx = new GitSCMSourceContext<>(null, SCMHeadObserver.none()) .withTraits(git.getTraits()); if (ctx.ignoreOnPushNotifications()) {
GitHubSCMSourceContext context = new GitHubSCMSourceContext(null, SCMHeadObserver.none()) .withTraits(src.getTraits()); if (context.wantBranches()) {
@Override public void afterSave() { WebhookRegistration mode = new GiteaSCMSourceContext(null, SCMHeadObserver.none()) .withTraits(new GiteaSCMNavigatorContext().withTraits(traits).traits()) .webhookRegistration(); GiteaWebhookListener.register(getOwner(), this, mode, credentialsId); }
@Override public void afterSave(@NonNull SCMNavigatorOwner owner) { WebhookRegistration mode = new GiteaSCMSourceContext(null, SCMHeadObserver.none()) .withTraits(new GiteaSCMNavigatorContext().withTraits(traits).traits()) .webhookRegistration(); GiteaWebhookListener.register(owner, this, mode, credentialsId); }
/** * {@inheritDoc} */ @NonNull @Override protected Set<String> retrieveRevisions(@NonNull final TaskListener listener) throws IOException, InterruptedException { final GitSCMSourceContext context = new GitSCMSourceContext<>(null, SCMHeadObserver.none()).withTraits(getTraits()); return doRetrieve(new Retriever<Set<String>>() { @Override public Set<String> run(GitClient client, String remoteName) throws IOException, InterruptedException { Set<String> revisions = new HashSet<String>(); if (context.wantBranches()) { for (Branch branch : client.getRemoteBranches()) { revisions.add(branch.getName().replaceFirst( "^" + Pattern.quote(context.remoteName()) + "/", "" )); } } if (context.wantTags()) { revisions.addAll(client.getTagNames("*")); } return revisions; } }, context, listener, false); }
PullRequestSCMHead head = (PullRequestSCMHead) revision.getHead(); try (GitHubSCMSourceRequest request = new GitHubSCMSourceContext(null, SCMHeadObserver.none()) .withTraits(traits) .newRequest(this, listener)) {
/** * {@inheritDoc} */ @CheckForNull @Override protected SCMRevision retrieve(@NonNull final String revision, @NonNull final TaskListener listener) throws IOException, InterruptedException { final GitSCMSourceContext context = new GitSCMSourceContext<>(null, SCMHeadObserver.none()).withTraits(getTraits()); return doRetrieve(new Retriever<SCMRevision>() { @Override public SCMRevision run(GitClient client, String remoteName) throws IOException, InterruptedException { String hash; try { hash = client.revParse(revision).name(); } catch (GitException x) { // Try prepending remote name in case it was a branch. try { hash = client.revParse(context.remoteName() + "/" + revision).name(); } catch (GitException x2) { listener.getLogger().println(x.getMessage()); listener.getLogger().println(x2.getMessage()); return null; } } return new SCMRevisionImpl(new SCMHead(revision), hash); } }, context, listener, false); }
@Override public boolean isMatch(SCMSource source) { if (source instanceof GitSCMSource) { GitSCMSource git = (GitSCMSource) source; GitSCMSourceContext ctx = new GitSCMSourceContext<>(null, SCMHeadObserver.none()) .withTraits(git.getTraits()); if (ctx.ignoreOnPushNotifications()) { return false; } URIish remote; try { remote = new URIish(git.getRemote()); } catch (URISyntaxException e) { // ignore return false; } if (GitStatus.looselyMatches(u, remote)) { notified[0] = true; return true; } return false; } return false; }
protected SCMRevision retrieve(@NonNull final SCMHead head, @NonNull TaskListener listener) throws IOException, InterruptedException { final GitSCMSourceContext context = new GitSCMSourceContext<>(null, SCMHeadObserver.none()).withTraits(getTraits()); return doRetrieve(new Retriever<SCMRevision>() { @Override
return; if (new GitHubSCMSourceContext(null, SCMHeadObserver.none()) .withTraits(((GitHubSCMSource) source).getTraits()) .notificationsDisabled()) {
GitHubSCMSourceContext context = new GitHubSCMSourceContext(null, SCMHeadObserver.none()) .withTraits(src.getTraits()); if (!fork && context.wantBranches()) {