Java Code Examples for jenkins.scm.api.SCMRevision#equals()
The following examples show how to use
jenkins.scm.api.SCMRevision#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GitHubSourceContext.java From github-integration-plugin with MIT License | 6 votes |
@SuppressWarnings({"rawtypes", "unchecked"}) private void forceScheduling(GitHubSCMRevision scmRevision) throws IOException { SCMSourceOwner owner = source.getOwner(); if (owner instanceof MultiBranchProject) { MultiBranchProject mb = (MultiBranchProject) owner; BranchProjectFactory pf = mb.getProjectFactory(); SCMHead scmHead = scmRevision.getHead(); Job j = mb.getItemByBranchName(scmHead.getName()); if (j != null) { SCMRevision rev = pf.getRevision(j); // set current rev to dummy to force scheduling if (rev != null && rev.equals(scmRevision)) { pf.setRevisionHash(j, new DummyRevision(scmHead)); } } } }
Example 2
Source File: ChangeRequestBuildStrategyImpl.java From basic-branch-build-strategies-plugin with MIT License | 5 votes |
/** * {@inheritDoc} */ @Restricted(ProtectedExternally.class) @Override public boolean isAutomaticBuild(@NonNull SCMSource source, @NonNull SCMHead head, @NonNull SCMRevision currRevision, @CheckForNull SCMRevision lastBuiltRevision, @CheckForNull SCMRevision lastSeenRevision, @NonNull TaskListener listener) { if (!(head instanceof ChangeRequestSCMHead)) { return false; } if (ignoreTargetOnlyChanges && currRevision instanceof ChangeRequestSCMRevision && lastBuiltRevision instanceof ChangeRequestSCMRevision) { ChangeRequestSCMRevision<?> curr = (ChangeRequestSCMRevision<?>) currRevision; if (curr.isMerge() && curr.equivalent((ChangeRequestSCMRevision<?>) lastBuiltRevision)) { return false; } } try { if (ignoreUntrustedChanges && !currRevision.equals(source.getTrustedRevision(currRevision, listener))) { return false; } } catch (IOException | InterruptedException e) { LogRecord lr = new LogRecord(Level.WARNING, "Could not determine trust status for revision {0} of {1}, assuming untrusted"); lr.setParameters(new Object[] {currRevision, head}); lr.setThrown(e); Functions.printLogRecord(lr); return false; } return true; }