hudson.plugins.mercurial
Class MercurialSCM

java.lang.Object
  extended by hudson.scm.SCM
      extended by hudson.plugins.mercurial.MercurialSCM
All Implemented Interfaces:
ExtensionPoint, Describable<SCM>, Serializable

public class MercurialSCM
extends SCM
implements Serializable

Mercurial SCM.

See Also:
Serialized Form

Nested Class Summary
static class MercurialSCM.DescriptorImpl
           
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
private  Set<String> _modules
          Prefixes of files within the repository which we're dependent on.
private  String branch
          In-repository branch to follow.
private  HgBrowser browser
           
(package private) static boolean CACHE_LOCAL_REPOS
           
private  boolean clean
           
private static ExecutorService executor
           
private static Pattern FILES_LINE
           
private static String FILES_STYLE
           
private  boolean forest
           
private  String installation
          Name of selected installation, if any.
private static Logger LOGGER
           
private  String modules
           
private static long serialVersionUID
           
private  String source
          Source repository URL from which we pull.
 
Fields inherited from class hudson.scm.SCM
PERMISSIONS, TAG
 
Constructor Summary
MercurialSCM(String installation, String source, String branch, String modules, HgBrowser browser, boolean clean, boolean forest)
           
 
Method Summary
 void buildEnvVars(AbstractBuild build, Map<String,String> env)
           
private  String cachedSource(Node node, Launcher launcher, TaskListener listener, boolean fromPolling)
           
 SCMRevisionState calcRevisionsFromBuild(AbstractBuild<?,?> build, Launcher launcher, TaskListener listener)
           
 boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspace, BuildListener listener, File changelogFile)
           
private  boolean clone(AbstractBuild<?,?> build, Launcher launcher, FilePath workspace, BuildListener listener, File changelogFile)
          Start from scratch and clone the whole repository.
protected  PollingResult compareRemoteRevisionWith(AbstractProject<?,?> project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState _baseline)
           
private  PollingResult.Change computeDegreeOfChanges(Set<String> changedFileNames, PrintStream output)
           
 ChangeLogParser createChangeLogParser()
           
private  Set<String> dependentChanges(Set<String> changedFileNames)
          Filter out the given file name list by picking up changes that are in the modules we care about.
private  ArgumentListBuilder findHgExe(AbstractBuild<?,?> build, TaskListener listener, boolean allowDebug)
           
(package private)  ArgumentListBuilder findHgExe(Node node, TaskListener listener, boolean allowDebug)
           
 String getBranch()
          In-repository branch to follow.
private  String getBranch(EnvVars env)
           
 HgBrowser getBrowser()
           
 MercurialSCM.DescriptorImpl getDescriptor()
           
 String getInstallation()
           
 String getModules()
           
 String getSource()
          Gets the source repository path.
 boolean isClean()
          True if we want clean check out each time.
 boolean isForest()
          True if we want consider workspace a forest
(package private) static int joinWithPossibleTimeout(Launcher.ProcStarter proc, boolean useTimeout, TaskListener listener)
           
private static int joinWithTimeout(Proc proc, long timeout, TimeUnit unit, TaskListener listener)
           
(package private) static Launcher.ProcStarter launch(Launcher launcher)
           
private  MercurialTagAction parseIncomingOutput(ByteArrayOutputStream output, MercurialTagAction baseline, Set<String> result)
           
private  void parseModules()
           
private  Object readResolve()
           
private  boolean update(AbstractBuild<?,?> build, Launcher launcher, FilePath workspace, BuildListener listener, File changelogFile)
          Updates the current workspace.
 
Methods inherited from class hudson.scm.SCM
_calcRevisionsFromBuild, _for, all, createEmptyChangeLog, getApi, getEffectiveBrowser, getModuleRoot, getModuleRoots, getType, nullify, poll, pollChanges, processWorkspaceBeforeDeletion, requiresWorkspaceForPolling, supportsPolling
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

installation

private final String installation
Name of selected installation, if any.


source

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


_modules

private transient Set<String> _modules
Prefixes of files within the repository which we're dependent on. Storing as member variable so as to only parse the dependencies string once. Will be either null (use whole repo), or nonempty list of subdir names.


modules

private final String modules

branch

private final String branch
In-repository branch to follow. Null indicates "default".


clean

private final boolean clean

forest

private final boolean forest

browser

private HgBrowser browser

FILES_STYLE

private static final String FILES_STYLE
See Also:
Constant Field Values

executor

private static final ExecutorService executor

FILES_LINE

private static Pattern FILES_LINE

CACHE_LOCAL_REPOS

static boolean CACHE_LOCAL_REPOS

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

LOGGER

private static final Logger LOGGER
Constructor Detail

MercurialSCM

@DataBoundConstructor
public MercurialSCM(String installation,
                                         String source,
                                         String branch,
                                         String modules,
                                         HgBrowser browser,
                                         boolean clean,
                                         boolean forest)
Method Detail

parseModules

private void parseModules()

readResolve

private Object readResolve()

getInstallation

public String getInstallation()

getSource

public String getSource()
Gets the source repository path. Either URL or local file path.


getBranch

public String getBranch()
In-repository branch to follow. Never null.


getBranch

private String getBranch(EnvVars env)

getBrowser

public HgBrowser getBrowser()
Overrides:
getBrowser in class SCM

isClean

public boolean isClean()
True if we want clean check out each time. This means deleting everything in the workspace (except .hg)


isForest

public boolean isForest()
True if we want consider workspace a forest


findHgExe

private ArgumentListBuilder findHgExe(AbstractBuild<?,?> build,
                                      TaskListener listener,
                                      boolean allowDebug)
                               throws IOException,
                                      InterruptedException
Throws:
IOException
InterruptedException

findHgExe

ArgumentListBuilder findHgExe(Node node,
                              TaskListener listener,
                              boolean allowDebug)
                        throws IOException,
                               InterruptedException
Parameters:
allowDebug - If the caller intends to parse the stdout from Mercurial, pass in false to indicate that the optional --debug option shall never be activated.
Throws:
IOException
InterruptedException

launch

static Launcher.ProcStarter launch(Launcher launcher)

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

joinWithPossibleTimeout

static int joinWithPossibleTimeout(Launcher.ProcStarter proc,
                                   boolean useTimeout,
                                   TaskListener listener)
                            throws IOException,
                                   InterruptedException
Throws:
IOException
InterruptedException

computeDegreeOfChanges

private PollingResult.Change computeDegreeOfChanges(Set<String> changedFileNames,
                                                    PrintStream output)

joinWithTimeout

private static int joinWithTimeout(Proc proc,
                                   long timeout,
                                   TimeUnit unit,
                                   TaskListener listener)
                            throws IOException,
                                   InterruptedException
Throws:
IOException
InterruptedException

dependentChanges

private Set<String> dependentChanges(Set<String> changedFileNames)
Filter out the given file name list by picking up changes that are in the modules we care about.


parseIncomingOutput

private MercurialTagAction parseIncomingOutput(ByteArrayOutputStream output,
                                               MercurialTagAction baseline,
                                               Set<String> result)
                                        throws IOException
Throws:
IOException

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

update

private boolean update(AbstractBuild<?,?> build,
                       Launcher launcher,
                       FilePath workspace,
                       BuildListener listener,
                       File changelogFile)
                throws InterruptedException,
                       IOException
Updates the current workspace.

Throws:
InterruptedException
IOException

clone

private boolean clone(AbstractBuild<?,?> build,
                      Launcher launcher,
                      FilePath workspace,
                      BuildListener listener,
                      File changelogFile)
               throws InterruptedException,
                      IOException
Start from scratch and clone the whole repository.

Throws:
InterruptedException
IOException

buildEnvVars

public void buildEnvVars(AbstractBuild build,
                         Map<String,String> env)
Overrides:
buildEnvVars in class SCM

createChangeLogParser

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

getDescriptor

public MercurialSCM.DescriptorImpl getDescriptor()
Specified by:
getDescriptor in interface Describable<SCM>
Overrides:
getDescriptor in class SCM

getModules

public String getModules()

cachedSource

private String cachedSource(Node node,
                            Launcher launcher,
                            TaskListener listener,
                            boolean fromPolling)


Copyright © 2010. All Rights Reserved.