org.jenkinsci.plugins.darcs
Class DarcsScm

java.lang.Object
  extended by hudson.scm.SCM
      extended by org.jenkinsci.plugins.darcs.DarcsScm
All Implemented Interfaces:
ExtensionPoint, Describable<SCM>, Serializable

public class DarcsScm
extends SCM
implements Serializable

Darcs is a patch based distributed version control system. Contains the job configuration options as fields.

Author:
Sven Strittmatter , Ralph Lange
See Also:
http://darcs.net/, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
private  DarcsRepositoryBrowser browser
          Used repository browser.
private  boolean clean
          Whether to wipe the checked out repository.
private  String localDir
          Local directory with repository.
private static Logger LOGGER
          Logging facility.
private static long serialVersionUID
          Serial version UID.
private  String source
          Source repository URL from which we pull.
 
Fields inherited from class hudson.scm.SCM
PERMISSIONS, TAG
 
Constructor Summary
DarcsScm(String source)
          Convenience constructor.
DarcsScm(String source, String localDir, boolean clean, DarcsRepositoryBrowser browser)
          Dedicated constructor.
 
Method Summary
static void addAliases()
          Add class name aliases for backward compatibility.
 SCMRevisionState calcRevisionsFromBuild(AbstractBuild<?,?> build, Launcher launcher, TaskListener listener)
           
 boolean checkout(AbstractBuild<?,?> build, Launcher launcher, FilePath workspace, BuildListener listener, File changelogFile)
           
protected  PollingResult compareRemoteRevisionWith(AbstractProject<?,?> project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline)
           
private  int countPatches(AbstractBuild<?,?> build, Launcher launcher, FilePath workspace, BuildListener listener)
          Counts the patches in a repository.
private  void createChangeLog(Launcher launcher, int numPatches, FilePath workspace, File changeLog, BuildListener listener)
          Writes the change log of the last numPatches to the changeLog file.
 ChangeLogParser createChangeLogParser()
           
private  FilePath createLocalPath(FilePath base)
          Creates a local path relative to the given base.
 DarcsRepositoryBrowser getBrowser()
           
 DarcsScmDescriptor getDescriptor()
           
 String getLocalDir()
          Get the local directory in the workspace.
private  boolean getRepo(AbstractBuild<?,?> build, Launcher launcher, FilePath workspace, BuildListener listener, File changeLog)
          Gets a fresh copy of a remote repository.
(package private)  DarcsRevisionState getRevisionState(Launcher launcher, TaskListener listener, String repo, FilePath workspace)
          Calculates the revision state of a repository (local or remote).
 String getSource()
          Get the repositories source URL.
 boolean isClean()
          Whether to clean the workspace or not.
private  boolean pullRepo(AbstractBuild<?,?> build, Launcher launcher, FilePath workspace, BuildListener listener, File changelogFile)
          Pulls all patches from a remote repository in the workspace repository.
 boolean requiresWorkspaceForPolling()
           
 boolean supportsPolling()
           
 
Methods inherited from class hudson.scm.SCM
_calcRevisionsFromBuild, _for, all, buildEnvVars, createEmptyChangeLog, getApi, getEffectiveBrowser, getModuleRoot, getModuleRoot, getModuleRoots, getModuleRoots, getType, nullify, poll, pollChanges, processWorkspaceBeforeDeletion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial version UID.

See Also:
Constant Field Values

LOGGER

private static final Logger LOGGER
Logging facility.


source

private final String source
Source repository URL from which we pull.


localDir

private final String localDir
Local directory with repository.


clean

private final boolean clean
Whether to wipe the checked out repository.


browser

private final DarcsRepositoryBrowser browser
Used repository browser.

Constructor Detail

DarcsScm

public DarcsScm(String source)
         throws SAXException
Convenience constructor. Sets local directory to #DEFAULT_LOCAL_DIR, clean to false and browser to null.

Parameters:
source - repository URL from which we pull
Throws:
SAXException

DarcsScm

@DataBoundConstructor
public DarcsScm(String source,
                                     String localDir,
                                     boolean clean,
                                     DarcsRepositoryBrowser browser)
Dedicated constructor.

Parameters:
source - repository URL from which we pull
localDir - Local directory in the workspace
clean - true cleans the workspace, false not
browser - the browser used to browse the repository
Method Detail

getSource

public String getSource()
Get the repositories source URL.

Returns:
URL as string

getLocalDir

public String getLocalDir()
Get the local directory in the workspace.

Returns:
relative path as string

isClean

public boolean isClean()
Whether to clean the workspace or not.

Returns:
true if clean is performed, false else

getBrowser

public DarcsRepositoryBrowser getBrowser()
Overrides:
getBrowser in class SCM

supportsPolling

public boolean supportsPolling()
Overrides:
supportsPolling in class SCM

requiresWorkspaceForPolling

public boolean requiresWorkspaceForPolling()
Overrides:
requiresWorkspaceForPolling in class SCM

calcRevisionsFromBuild

public SCMRevisionState calcRevisionsFromBuild(AbstractBuild<?,?> build,
                                               Launcher launcher,
                                               TaskListener listener)
                                        throws IOException,
                                               InterruptedException
Specified by:
calcRevisionsFromBuild in class SCM
Throws:
IOException
InterruptedException

compareRemoteRevisionWith

protected PollingResult compareRemoteRevisionWith(AbstractProject<?,?> project,
                                                  Launcher launcher,
                                                  FilePath workspace,
                                                  TaskListener listener,
                                                  SCMRevisionState baseline)
                                           throws IOException,
                                                  InterruptedException
Specified by:
compareRemoteRevisionWith in class SCM
Throws:
IOException
InterruptedException

getRevisionState

DarcsRevisionState getRevisionState(Launcher launcher,
                                    TaskListener listener,
                                    String repo,
                                    FilePath workspace)
                              throws InterruptedException
Calculates the revision state of a repository (local or remote).

Parameters:
launcher -
listener -
repo -
Returns:
Throws:
InterruptedException

createChangeLog

private void createChangeLog(Launcher launcher,
                             int numPatches,
                             FilePath workspace,
                             File changeLog,
                             BuildListener listener)
                      throws InterruptedException
Writes the change log of the last numPatches to the changeLog file.

Parameters:
launcher -
numPatches -
workspace -
changeLog -
Throws:
InterruptedException

checkout

public boolean checkout(AbstractBuild<?,?> build,
                        Launcher launcher,
                        FilePath workspace,
                        BuildListener listener,
                        File changelogFile)
                 throws IOException,
                        InterruptedException
Specified by:
checkout in class SCM
Throws:
IOException
InterruptedException

countPatches

private int countPatches(AbstractBuild<?,?> build,
                         Launcher launcher,
                         FilePath workspace,
                         BuildListener listener)
Counts the patches in a repository.

Parameters:
build -
launcher -
workspace -
listener -
Returns:
Throws:
InterruptedException
IOException

pullRepo

private boolean pullRepo(AbstractBuild<?,?> build,
                         Launcher launcher,
                         FilePath workspace,
                         BuildListener listener,
                         File changelogFile)
                  throws InterruptedException,
                         IOException
Pulls all patches from a remote repository in the workspace repository.

Parameters:
build -
launcher -
workspace -
listener -
changelogFile -
Returns:
boolean
Throws:
InterruptedException
IOException

getRepo

private boolean getRepo(AbstractBuild<?,?> build,
                        Launcher launcher,
                        FilePath workspace,
                        BuildListener listener,
                        File changeLog)
                 throws InterruptedException
Gets a fresh copy of a remote repository.

Parameters:
build -
launcher -
workspace -
listener -
changelogFile -
Returns:
boolean
Throws:
InterruptedException

createChangeLogParser

public ChangeLogParser createChangeLogParser()
Specified by:
createChangeLogParser in class SCM

getDescriptor

public DarcsScmDescriptor getDescriptor()
Specified by:
getDescriptor in interface Describable<SCM>
Overrides:
getDescriptor in class SCM

createLocalPath

private FilePath createLocalPath(FilePath base)
Creates a local path relative to the given base. If localDir is not null and not empty a relative path to the given base is created, else the base pat itself is returned. *

Parameters:
base - base of the local path
Returns:
local file path.

addAliases

@Initializer(before=PLUGINS_STARTED)
public static void addAliases()
Add class name aliases for backward compatibility.



Copyright © 2004-2013 weltraumschaf.de. All Rights Reserved.