public List<BuildChooserDescriptor> getBuildChooserDescriptors() { return BuildChooser.all(); }
IGitAPI git, TaskListener listener, BuildData buildData, BuildChooserContext context) throws GitException, IOException, InterruptedException { return getCandidateRevisions(isPollCall,singleBranch,git,listener,buildData);
/** * Short-hand to get to the display name. */ public final String getDisplayName() { return getDescriptor().getDisplayName(); }
/** * @deprecated as of 1.2.0 * Use and override {@link #prevBuildForChangelog(String, BuildData, org.jenkinsci.plugins.gitclient.GitClient, BuildChooserContext)} * @param branch contains the name of a 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 data * Information that captures what we did during the last build. * @param git * Used for invoking Git * @param context * Object that provides access back to the model object. This is because * the build chooser can be invoked on a slave where there's no direct access * to the build/project for which this is invoked. * * If {@code isPollCall} is false, then call back to both project and build are available. * If {@code isPollCall} is true, then only the callback to the project is available as there's * no contextual build object. * @return * the candidate revision. Can be an empty set to indicate that there's nothing to build. * @throws IOException on I/O error * @throws GitException on git error * @throws InterruptedException if interrupted */ public Build prevBuildForChangelog(String branch, @Nullable BuildData data, IGitAPI git, BuildChooserContext context) throws IOException,InterruptedException { return prevBuildForChangelog(branch,data,git); }
listener.getLogger().println("Using strategy: " + buildChooser.getDisplayName());
private PollingResult compareRemoteRevisionWithImpl(Job<?, ?> project, Launcher launcher, FilePath workspace, final @NonNull TaskListener listener) throws IOException, InterruptedException { listener.getLogger().println("Using strategy: " + getBuildChooser().getDisplayName()); Collection<Revision> candidates = getBuildChooser().getCandidateRevisions( true, singleBranch, git, listener, buildData, new BuildChooserContextImpl(project, null, environment));
Collection<Revision> candidates = Collections.EMPTY_LIST; final BuildChooserContext context = new BuildChooserContextImpl(build.getParent(), build, environment); getBuildChooser().prepareWorkingTree(git, listener, context); final String singleBranch = environment.expand( getSingleBranch(environment) ); candidates = getBuildChooser().getCandidateRevisions( false, singleBranch, git, listener, buildData, context);
public List<BuildChooserDescriptor> getBuildChooserDescriptors(Item job) { if (job == null) { return getBuildChooserDescriptors(); } return BuildChooser.allApplicableTo(job); }
/** * Determines the baseline to compute the changelog against. * * <p> * {@link #getCandidateRevisions(boolean, String, IGitAPI, TaskListener, BuildData, BuildChooserContext)} determine * what commits can be subject for a build, and for each commit it determines the branches that contribute to them. * * <p> * Once {@link GitSCM} picks up a specific {@link Revision} to build, {@linkplain Revision#getBranches() for each branch}, * in that revision, this method is called to compute the changelog. * * @param branch * The branch name. * @param data * Information that captures what we did during the last build. * @param git * Used for invoking Git * @param context * Object that provides access back to the model object. This is because * the build chooser can be invoked on a slave where there's no direct access * to the build/project for which this is invoked. * @return preceding build * @throws IOException on input or output error * @throws InterruptedException when interrupted * @return * the candidate revision. Can be an empty set to indicate that there's nothing to build. */ public Build prevBuildForChangelog(String branch, @Nullable BuildData data, GitClient git, BuildChooserContext context) throws IOException,InterruptedException { return prevBuildForChangelog(branch,data, (IGitAPI) git, context); }
.println( "Checkout:" + workspace.getName() + " / " + workspace.getRemote() + " - " + workspace.getChannel()); listener.getLogger().println("Using strategy: " + buildChooser.getDisplayName());
public List<BuildChooserDescriptor> getBuildChooserDescriptors() { return BuildChooser.all(); }
public Boolean invoke(File localWorkspace, VirtualChannel channel) throws IOException { IGitAPI git = new GitAPI(gitExe, new FilePath(localWorkspace), listener, environment); if (git.hasGitRepo()) { // Repo is there - do a fetch listener.getLogger().println("Fetching changes from the remote Git repositories"); // Fetch updates for (RemoteConfig remoteRepository : paramRepos) { fetchFrom(git, listener, remoteRepository); } listener.getLogger().println("Polling for changes in"); Collection<Revision> origCandidates = buildChooser.getCandidateRevisions( true, singleBranch, git, listener, buildData); List<Revision> candidates = new ArrayList<Revision>(); for (Revision c : origCandidates) { if (!isRevExcluded(git, c, listener)) { candidates.add(c); } } return (candidates.size() > 0); } else { listener.getLogger().println("No Git repository yet, an initial checkout is required"); return true; } } });
try { for (Branch b : revToBuild.getBranches()) { Build lastRevWas = buildChooser.prevBuildForChangelog(b.getName(), buildData, git); if (lastRevWas != null) { if (git.isCommitInRepo(lastRevWas.getSHA1().name())) {
listener.getLogger().println("Using strategy: " + buildChooser.getDisplayName());
/** * Short-hand to get to the display name. * @return display name of this build chooser */ public final String getDisplayName() { return getDescriptor().getDisplayName(); }
public List<BuildChooserDescriptor> getBuildChooserDescriptors() { return BuildChooser.all(); }
Collection<Revision> origCanditates = buildChooser.getCandidateRevisions(true, singleBranch, git, listener, buildData);
try { for (Branch b : revToBuild.getBranches()) { Build lastRevWas = buildChooser.prevBuildForChangelog(b.getName(), buildData, git); if (lastRevWas != null) { if (git.isCommitInRepo(lastRevWas.getSHA1().name())) {
.println( "Checkout:" + workspace.getName() + " / " + workspace.getRemote() + " - " + workspace.getChannel()); listener.getLogger().println("Using strategy: " + buildChooser.getDisplayName());
/** * Short-hand to get to the display name. */ public final String getDisplayName() { return getDescriptor().getDisplayName(); }