@Override @Nonnull public List<ChangeLogSet<? extends ChangeLogSet.Entry>> getChangeSets() { ChangeLogSet<? extends Entry> cs = getChangeSet(); return cs.isEmptySet() ? Collections.emptyList() : Collections.singletonList(cs); }
@Override @Nonnull public List<ChangeLogSet<? extends ChangeLogSet.Entry>> getChangeSets() { ChangeLogSet<? extends Entry> cs = getChangeSet(); return cs.isEmptySet() ? Collections.emptyList() : Collections.singletonList(cs); }
public static List<ChangeLogSet<? extends Entry>> getChanges(Run<?, ?> run) { if (run instanceof AbstractBuild) { ChangeLogSet<? extends Entry> cs = ((AbstractBuild<?, ?>) run).getChangeSet(); return cs.isEmptySet() ? Collections.<ChangeLogSet<? extends ChangeLogSet.Entry>>emptyList() : Collections.<ChangeLogSet<? extends ChangeLogSet.Entry>>singletonList(cs); } else if (run == null) { throw new IllegalStateException("run cannot be null!"); } else { return getChangesUsingReflection(run); } }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") public Iterator<T> iterator() { return isEmptySet()? Iterators.<T>emptyIterator(): getLogs().iterator(); }
public boolean hasChangeSet() { if (build instanceof AbstractBuild) { return !((AbstractBuild<?, ?>) build).getChangeSet().isEmptySet(); } else if (build instanceof WorkflowRun) { return !((WorkflowRun) build).getChangeSets().isEmpty(); } return false; }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") public Iterator<T> iterator() { return isEmptySet()? Iterators.<T>emptyIterator(): getLogs().iterator(); }
@GET @Path("changes") public ChangesDTO getChanges(final @PathParam("projectName") String projectName, final @PathParam("buildNumber") int buildNumber) { log.debug("Get changes: {} #{}", projectName, buildNumber); AbstractBuild build = support.getBuild(projectName, buildNumber); if (build.getChangeSet().isEmptySet()) { throw new WebApplicationException(NO_CONTENT); } return changesx.convert(build.getChangeSet()); }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") public Iterator<T> iterator() { return isEmptySet() ? Iterators.<T>emptyIterator() : getLogs().iterator(); }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") public Iterator<T> iterator() { return isEmptySet()? Iterators.<T>emptyIterator(): getLogs().iterator(); }
public void add(String scmClass, String scmFriendlyName, ChangeLogSet<? extends Entry> cls) { if(!cls.isEmptySet()) { ChangeLogSetWrapper wrapper = changes.get(scmClass); if(wrapper == null) { wrapper = new ChangeLogSetWrapper(build, cls.getBrowser(), scmFriendlyName, cls.getClass()); changes.put(scmClass, wrapper); } wrapper.addChanges(cls); } kinds.add(cls.getKind()); }
@Override public String buildCompletionMessage(IMPublisher publisher, AbstractBuild<?, ?> build, BuildListener listener) throws IOException, InterruptedException { StringBuilder sb = new StringBuilder(super.buildCompletionMessage(publisher,build,listener)); if (!build.getChangeSet().isEmptySet()) { boolean hasManyChangeSets = build.getChangeSet().getItems().length > 1; for (Entry entry : build.getChangeSet()) { sb.append("\n"); if (hasManyChangeSets) { sb.append("* "); } sb.append(entry.getAuthor()).append(": ").append(entry.getMsg()); } } return sb.toString(); }
@Override public String buildCompletionMessage(IMPublisher publisher, AbstractBuild<?, ?> build, BuildListener listener) throws IOException, InterruptedException { StringBuilder sb = new StringBuilder(super.buildCompletionMessage(publisher,build,listener)); if (!build.getChangeSet().isEmptySet()) { boolean hasManyChangeSets = build.getChangeSet().getItems().length > 1; for (Entry entry : build.getChangeSet()) { sb.append("\n"); if (hasManyChangeSets) { sb.append("* "); } sb.append(entry.getAuthor()).append(": ").append(entry.getMsg()); } } return sb.toString(); }
@Override @Exported public synchronized List<ChangeLogSet<? extends ChangeLogSet.Entry>> getChangeSets() { if (changeSets == null) { changeSets = new ArrayList<>(); for (SCMCheckout co : checkouts(null)) { if (co.changelogFile != null && co.changelogFile.isFile()) { try { ChangeLogSet<? extends ChangeLogSet.Entry> changeLogSet = co.scm.createChangeLogParser().parse(this, co.scm.getEffectiveBrowser(), co.changelogFile); if (!changeLogSet.isEmptySet()) { changeSets.add(changeLogSet); } } catch (Exception x) { LOGGER.log(Level.WARNING, "could not parse " + co.changelogFile, x); } } } } return changeSets; }
private void onCheckout(SCM scm, FilePath workspace, TaskListener listener, @CheckForNull File changelogFile, @CheckForNull SCMRevisionState pollingBaseline) throws Exception { if (changelogFile != null && changelogFile.isFile()) { ChangeLogSet<?> cls = scm.createChangeLogParser().parse(this, scm.getEffectiveBrowser(), changelogFile); if (!cls.isEmptySet()) { getChangeSets().add(cls); } for (SCMListener l : SCMListener.all()) { l.onChangeLogParsed(this, scm, listener, cls); } } checkouts(listener).add(new SCMCheckout(scm, FilePathUtils.getNodeName(workspace), workspace.getRemote(), changelogFile, pollingBaseline)); }
/** * Appends build URL to the builder. * * @param build build. * @param buf {@link StringBuilder}. */ protected void appendBuildUrl(AbstractBuild<?, ?> build, StringBuilder buf) { appendUrl(Util.encode(build.getUrl()) + (build.getChangeSet().isEmptySet() ? "" : "changes"), buf); }
/** * Appends build URL to the builder. * * @param build build. * @param buf {@link StringBuilder}. */ protected void appendBuildUrl(AbstractBuild<?, ?> build, StringBuilder buf) { appendUrl(Util.encode(build.getUrl()) + (build.getChangeSet().isEmptySet() ? "" : "changes"), buf); }
/** * Appends build URL to the builder. * * @param build build. * @param buf {@link StringBuilder}. */ protected void appendBuildUrl(AbstractBuild<?, ?> build, StringBuilder buf) { appendUrl(Util.encode(build.getUrl()) + (build.getChangeSet().isEmptySet() ? "" : "changes"), buf); }
/** * Appends build URL to the builder. * * @param build build. * @param buf {@link StringBuilder}. */ protected void appendBuildUrl(AbstractBuild<?, ?> build, StringBuilder buf) { appendUrl(Util.encode(build.getUrl()) + (build.getChangeSet().isEmptySet() ? "" : "changes"), buf); }
@Test public void changelogIsDisabled() throws Exception { AbstractBuild<?, ?> b; FreeStyleProject p = j.createFreeStyleProject(); p.setScm(new MercurialSCM(hgInstallation(), repo.getPath(), MercurialSCM.RevisionType.BRANCH, null, null, null, null, false, null, true)); m.hg(repo, "init"); m.touchAndCommit(repo, "dir1/f1"); b = p.scheduleBuild2(0).get(); assertTrue(b.getChangeSet().isEmptySet()); m.touchAndCommit(repo, "dir2/f1"); b = p.scheduleBuild2(0).get(); assertTrue(b.getChangeSet().isEmptySet()); } }
/** * Control case for {@link #changelogOnClone()}. */ @Test public void changelogOnUpdate() throws Exception { AbstractBuild<?, ?> b; FreeStyleProject p = j.createFreeStyleProject(); p.setScm(new MercurialSCM(hgInstallation(), repo.getPath(), null, null, null, null, false)); m.hg(repo, "init"); m.touchAndCommit(repo, "dir1/f1"); b = p.scheduleBuild2(0).get(); assertTrue(b.getChangeSet().isEmptySet()); m.touchAndCommit(repo, "dir2/f1"); b = p.scheduleBuild2(0).get(); assertChangeSetPaths( Collections.singletonList(Collections.singleton("dir2/f1")), b); m.touchAndCommit(repo, "dir3/f1"); b = p.scheduleBuild2(0).get(); assertChangeSetPaths( Collections.singletonList(Collections.singleton("dir3/f1")), b); }