hudson.plugins.git
Class GitSCM

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

public class GitSCM
extends hudson.scm.SCM
implements Serializable

Git SCM.

Author:
Nigel Magnay
See Also:
Serialized Form

Nested Class Summary
static class GitSCM.DescriptorImpl
           
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
static String GIT_BRANCH
           
static String GIT_COMMIT
           
static boolean VERBOSE
          Set to true to enable more logging to build's TaskListener.
 
Fields inherited from class hudson.scm.SCM
PERMISSIONS, TAG
 
Constructor Summary
GitSCM(List<org.spearce.jgit.transport.RemoteConfig> repositories, List<BranchSpec> branches, PreBuildMergeOptions mergeOptions, boolean doGenerateSubmoduleConfigurations, Collection<SubmoduleConfig> submoduleCfg, boolean clean, boolean wipeOutWorkspace, BuildChooser buildChooser, GitRepositoryBrowser browser, String gitTool, boolean authorOrCommitter, String relativeTargetDir, String excludedRegions, String excludedUsers, String localBranch, boolean recursiveSubmodules, boolean pruneBranches, String gitConfigName, String gitConfigEmail, boolean skipTag)
           
GitSCM(String repositoryUrl)
          A convenience constructor that sets everything to default.
 
Method Summary
 void buildEnvVars(hudson.model.AbstractBuild<?,?> build, Map<String,String> env)
           
 hudson.scm.SCMRevisionState calcRevisionsFromBuild(hudson.model.AbstractBuild<?,?> abstractBuild, hudson.Launcher launcher, hudson.model.TaskListener taskListener)
           
 boolean checkout(hudson.model.AbstractBuild build, hudson.Launcher launcher, hudson.FilePath workspace, hudson.model.BuildListener listener, File changelogFile)
           
protected  hudson.scm.PollingResult compareRemoteRevisionWith(hudson.model.AbstractProject<?,?> project, hudson.Launcher launcher, hudson.FilePath workspace, hudson.model.TaskListener listener, hudson.scm.SCMRevisionState baseline)
           
 hudson.scm.ChangeLogParser createChangeLogParser()
           
 boolean getAuthorOrCommitter()
          Use either author or committer.
 List<BranchSpec> getBranches()
           
 GitRepositoryBrowser getBrowser()
           
 BuildChooser getBuildChooser()
           
 BuildData getBuildData(hudson.model.Run build, boolean clone)
          Look back as far as needed to find a valid BuildData.
 boolean getClean()
           
 boolean getDoGenerate()
           
 String getExcludedRegions()
           
 String[] getExcludedRegionsNormalized()
           
 String getExcludedUsers()
           
 Set<String> getExcludedUsersNormalized()
           
 String getGitConfigEmail()
           
 String getGitConfigEmailToUse()
           
 String getGitConfigName()
           
 String getGitConfigNameToUse()
           
 String getGitExe(hudson.model.Node builtOn, hudson.model.TaskListener listener)
          Exposing so that we can get this from GitPublisher.
 String getGitTool()
           
 String getLocalBranch()
           
 PreBuildMergeOptions getMergeOptions()
           
 List<org.spearce.jgit.transport.RemoteConfig> getParamExpandedRepos(hudson.model.AbstractBuild<?,?> build)
          Expand parameters in remoteRepositories with the parameter values provided in the given build and return them.
 String getParamLocalBranch(hudson.model.AbstractBuild<?,?> build)
           
 boolean getPruneBranches()
           
 boolean getRecursiveSubmodules()
           
 String getRelativeTargetDir()
           
 List<org.spearce.jgit.transport.RemoteConfig> getRepositories()
           
 org.spearce.jgit.transport.RemoteConfig getRepositoryByName(String repoName)
           
 boolean getSkipTag()
           
 Collection<SubmoduleConfig> getSubmoduleCfg()
           
 org.spearce.jgit.transport.RemoteConfig getSubmoduleRepository(IGitAPI parentGit, org.spearce.jgit.transport.RemoteConfig orig, String name)
           
 boolean getWipeOutWorkspace()
           
 Object readResolve()
           
 void setSubmoduleCfg(Collection<SubmoduleConfig> submoduleCfg)
           
protected  hudson.FilePath workingDirectory(hudson.FilePath workspace)
          Given the workspace, gets the working directory, which will be the workspace if no relative target dir is specified.
 
Methods inherited from class hudson.scm.SCM
_calcRevisionsFromBuild, _for, all, createEmptyChangeLog, getApi, getDescriptor, getEffectiveBrowser, getModuleRoot, getModuleRoot, getModuleRoots, 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

GIT_BRANCH

public static final String GIT_BRANCH
See Also:
Constant Field Values

GIT_COMMIT

public static final String GIT_COMMIT
See Also:
Constant Field Values

VERBOSE

public static boolean VERBOSE
Set to true to enable more logging to build's TaskListener. Used by various classes in this package.

Constructor Detail

GitSCM

public GitSCM(String repositoryUrl)
       throws IOException
A convenience constructor that sets everything to default.

Parameters:
repositoryUrl - Repository URL to clone from.
Throws:
IOException - exception.

GitSCM

@DataBoundConstructor
public GitSCM(List<org.spearce.jgit.transport.RemoteConfig> repositories,
                                   List<BranchSpec> branches,
                                   PreBuildMergeOptions mergeOptions,
                                   boolean doGenerateSubmoduleConfigurations,
                                   Collection<SubmoduleConfig> submoduleCfg,
                                   boolean clean,
                                   boolean wipeOutWorkspace,
                                   BuildChooser buildChooser,
                                   GitRepositoryBrowser browser,
                                   String gitTool,
                                   boolean authorOrCommitter,
                                   String relativeTargetDir,
                                   String excludedRegions,
                                   String excludedUsers,
                                   String localBranch,
                                   boolean recursiveSubmodules,
                                   boolean pruneBranches,
                                   String gitConfigName,
                                   String gitConfigEmail,
                                   boolean skipTag)
Method Detail

getSubmoduleCfg

public Collection<SubmoduleConfig> getSubmoduleCfg()

setSubmoduleCfg

public void setSubmoduleCfg(Collection<SubmoduleConfig> submoduleCfg)

readResolve

public Object readResolve()

getExcludedRegions

public String getExcludedRegions()

getExcludedRegionsNormalized

public String[] getExcludedRegionsNormalized()

getExcludedUsers

public String getExcludedUsers()

getExcludedUsersNormalized

public Set<String> getExcludedUsersNormalized()

getBrowser

public GitRepositoryBrowser getBrowser()
Overrides:
getBrowser in class hudson.scm.SCM

getGitConfigName

public String getGitConfigName()

getGitConfigEmail

public String getGitConfigEmail()

getGitConfigNameToUse

public String getGitConfigNameToUse()

getGitConfigEmailToUse

public String getGitConfigEmailToUse()

getSkipTag

public boolean getSkipTag()

getPruneBranches

public boolean getPruneBranches()

getWipeOutWorkspace

public boolean getWipeOutWorkspace()

getClean

public boolean getClean()

getBuildChooser

public BuildChooser getBuildChooser()

getParamExpandedRepos

public List<org.spearce.jgit.transport.RemoteConfig> getParamExpandedRepos(hudson.model.AbstractBuild<?,?> build)
Expand parameters in remoteRepositories with the parameter values provided in the given build and return them.

Returns:
can be empty but never null.

getRepositoryByName

public org.spearce.jgit.transport.RemoteConfig getRepositoryByName(String repoName)

getRepositories

public List<org.spearce.jgit.transport.RemoteConfig> getRepositories()

getGitTool

public String getGitTool()

calcRevisionsFromBuild

public hudson.scm.SCMRevisionState calcRevisionsFromBuild(hudson.model.AbstractBuild<?,?> abstractBuild,
                                                          hudson.Launcher launcher,
                                                          hudson.model.TaskListener taskListener)
                                                   throws IOException,
                                                          InterruptedException
Specified by:
calcRevisionsFromBuild in class hudson.scm.SCM
Throws:
IOException
InterruptedException

getSubmoduleRepository

public org.spearce.jgit.transport.RemoteConfig getSubmoduleRepository(IGitAPI parentGit,
                                                                      org.spearce.jgit.transport.RemoteConfig orig,
                                                                      String name)
                                                               throws GitException
Throws:
GitException

getGitExe

public String getGitExe(hudson.model.Node builtOn,
                        hudson.model.TaskListener listener)
Exposing so that we can get this from GitPublisher.

Parameters:
builtOn - Node.
listener - TaskListener.

getAuthorOrCommitter

public boolean getAuthorOrCommitter()
Use either author or committer.

Returns:
if true, use the commit author as the changeset author, rather than the committer.

checkout

public boolean checkout(hudson.model.AbstractBuild build,
                        hudson.Launcher launcher,
                        hudson.FilePath workspace,
                        hudson.model.BuildListener listener,
                        File changelogFile)
                 throws IOException,
                        InterruptedException
Specified by:
checkout in class hudson.scm.SCM
Throws:
IOException
InterruptedException

buildEnvVars

public void buildEnvVars(hudson.model.AbstractBuild<?,?> build,
                         Map<String,String> env)
Overrides:
buildEnvVars in class hudson.scm.SCM

createChangeLogParser

public hudson.scm.ChangeLogParser createChangeLogParser()
Specified by:
createChangeLogParser in class hudson.scm.SCM

getRecursiveSubmodules

public boolean getRecursiveSubmodules()

getDoGenerate

public boolean getDoGenerate()

getBranches

public List<BranchSpec> getBranches()

getMergeOptions

public PreBuildMergeOptions getMergeOptions()

getBuildData

public BuildData getBuildData(hudson.model.Run build,
                              boolean clone)
Look back as far as needed to find a valid BuildData. BuildData may not be recorded if an exception occurs in the plugin logic.

Parameters:
build - build.
clone - is clone.
Returns:
the last recorded build data

getLocalBranch

public String getLocalBranch()

getParamLocalBranch

public String getParamLocalBranch(hudson.model.AbstractBuild<?,?> build)

getRelativeTargetDir

public String getRelativeTargetDir()

workingDirectory

protected hudson.FilePath workingDirectory(hudson.FilePath workspace)
Given the workspace, gets the working directory, which will be the workspace if no relative target dir is specified. Otherwise, it'll be "workspace/relativeTargetDir".

Parameters:
workspace -
Returns:
working directory

compareRemoteRevisionWith

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


Copyright © 2004-2011 Hudson. All Rights Reserved.