package hudson.scm; import hudson.ExtensionPoint; import hudson.FilePath; import hudson.Launcher; import hudson.model.AbstractBuild; import hudson.model.AbstractProject; import hudson.model.BuildListener; import hudson.model.Describable; import hudson.model.TaskListener; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.Map; /** * Captures the configuration information in it. * *
* To register a custom {@link SCM} implementation from a plugin,
* add it to {@link SCMS#SCMS}.
*
* @author Kohsuke Kawaguchi
*/
public abstract class SCM implements Describable
* The "update" operation can be performed instead of a fresh checkout if
* feasible.
*
*
* This operation should also capture the information necessary to tag the workspace later.
*
* @param launcher
* Abstracts away the machine that the files will be checked out.
* @param workspace
* a directory to check out the source code. May contain left-over
* from the previous build.
* @param changelogFile
* Upon a successful return, this file should capture the changelog.
* When there's no change, this file should contain an empty entry.
* See {@link AbstractCVSFamilySCM#createEmptyChangeLog(File, BuildListener, String)}.
* @return
* false if the operation fails. The error should be reported to the listener.
* Otherwise return the changes included in this update (if this was an update.)
*
* @throws InterruptedException
* interruption is usually caused by the user aborting the build.
* this exception will cause the build to fail.
*/
public abstract boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspace, BuildListener listener, File changelogFile) throws IOException, InterruptedException;
/**
* Checks out (or updates) the code into the workspace, but without computing changelog.
*
* TODO: This is an ugly abstraction.
* come back and check if this abstraction is really making much sense.
*/
public abstract boolean checkout(Launcher launcher, FilePath workspace, TaskListener listener) throws IOException, InterruptedException;
/**
* Adds environmental variables for the builds to the given map.
*/
public abstract void buildEnvVars(Map