public Build prevBuildForChangelog(String singleBranch, BuildData data, IGitAPI git) { return data == null ? null : data.getLastBuildOfBranch(singleBranch); }
public Build prevBuildForChangelog(String singleBranch, BuildData data, IGitAPI git) { return data == null ? null : data.getLastBuildOfBranch(singleBranch); }
/** * @deprecated as of 1.1.25 * Use and override {@link #prevBuildForChangelog(String, BuildData, IGitAPI, BuildChooserContext)} * @param branch contains the name of branch to be built * this will be non-null only in the simple case, in advanced * cases with multiple repositories and/or branches specified * then this value will be null. * @param buildData build data to be used * Information that captures what we did during the last build. * @param git * Used for invoking Git * @return * the candidate revision. Can be an empty set to indicate that there's nothi */ public Build prevBuildForChangelog(String branch, @Nullable BuildData buildData, IGitAPI git) { return buildData == null ? null : buildData.getLastBuildOfBranch(branch); }
private String getLastBuiltCommitOfBranch(Run<?, ?> build, Branch branch) { String prevCommit = null; if (build.getPreviousBuiltBuild() != null) { final Build lastBuildOfBranch = fixNull(getBuildData(build.getPreviousBuiltBuild())).getLastBuildOfBranch(branch.getName()); if (lastBuildOfBranch != null) { Revision previousRev = lastBuildOfBranch.getRevision(); if (previousRev != null) { prevCommit = previousRev.getSha1String(); } } } return prevCommit; }
private String getLastSuccessfulBuiltCommitOfBranch(Run<?, ?> build, Branch branch) { String prevCommit = null; if (build.getPreviousSuccessfulBuild() != null) { final Build lastSuccessfulBuildOfBranch = fixNull(getBuildData(build.getPreviousSuccessfulBuild())).getLastBuildOfBranch(branch.getName()); if (lastSuccessfulBuildOfBranch != null) { Revision previousRev = lastSuccessfulBuildOfBranch.getRevision(); if (previousRev != null) { prevCommit = previousRev.getSha1String(); } } } return prevCommit; }
@Override public Build prevBuildForChangelog(String singleBranch, BuildData data, GitClient git, BuildChooserContext context) throws InterruptedException, IOException { if (data != null) { ObjectId sha1 = git.revParse("FETCH_HEAD"); // Now we cheat and add the parent as the last build on the branch, so we can // get the changelog working properly-ish. ObjectId parentSha1 = getFirstParent(sha1, git); Revision parentRev = new Revision(parentSha1); parentRev.getBranches().add(new Branch(singleBranch, parentSha1)); int prevBuildNum = 0; Result r = null; Build lastBuild = data.getLastBuildOfBranch(singleBranch); if (lastBuild != null) { prevBuildNum = lastBuild.getBuildNumber(); r = lastBuild.getBuildResult(); } return new Build(parentRev, prevBuildNum, r); } else { //Hmm no sure what to do here, but the git plugin can handle us returning null here return null; } }