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>, java.io.Serializable

public class GitSCM
extends hudson.scm.SCM
implements java.io.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 java.lang.String GIT_BRANCH
           
static java.lang.String GIT_COMMIT
           
 java.lang.String gitTool
           
 
Fields inherited from class hudson.scm.SCM
PERMISSIONS, TAG
 
Constructor Summary
GitSCM(java.util.List<org.spearce.jgit.transport.RemoteConfig> repositories, java.util.List<BranchSpec> branches, PreBuildMergeOptions mergeOptions, boolean doGenerateSubmoduleConfigurations, java.util.Collection<SubmoduleConfig> submoduleCfg, boolean clean, boolean wipeOutWorkspace, BuildChooser buildChooser, GitRepositoryBrowser browser, java.lang.String gitTool, boolean authorOrCommitter, java.lang.String relativeTargetDir, java.lang.String excludedRegions, java.lang.String excludedUsers, java.lang.String localBranch, boolean recursiveSubmodules, boolean pruneBranches)
           
GitSCM(java.lang.String repositoryUrl)
          A convenience constructor that sets everything to default.
 
Method Summary
 void buildEnvVars(hudson.model.AbstractBuild build, java.util.Map<java.lang.String,java.lang.String> env)
           
 boolean checkout(hudson.model.AbstractBuild build, hudson.Launcher launcher, hudson.FilePath workspace, hudson.model.BuildListener listener, java.io.File changelogFile)
           
 hudson.scm.ChangeLogParser createChangeLogParser()
           
 boolean getAuthorOrCommitter()
          If true, use the commit author as the changeset author, rather than the committer.
 java.util.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()
           
 java.lang.String getExcludedRegions()
           
 java.lang.String[] getExcludedRegionsNormalized()
           
 java.lang.String getExcludedUsers()
           
 java.util.Set<java.lang.String> getExcludedUsersNormalized()
           
 java.lang.String getGitExe(hudson.model.Node builtOn, hudson.model.TaskListener listener)
          Exposing so that we can get this from GitPublisher.
 java.lang.String getGitTool()
           
 java.lang.String getLocalBranch()
           
 PreBuildMergeOptions getMergeOptions()
           
 java.util.List<org.spearce.jgit.transport.RemoteConfig> getParamExpandedRepos(hudson.model.AbstractBuild<?,?> build)
           
 boolean getPruneBranches()
           
 boolean getRecursiveSubmodules()
           
 java.lang.String getRelativeTargetDir()
           
 java.util.List<org.spearce.jgit.transport.RemoteConfig> getRepositories()
           
 org.spearce.jgit.transport.RemoteConfig getRepositoryByName(java.lang.String repoName)
           
 java.util.Collection<SubmoduleConfig> getSubmoduleCfg()
           
 org.spearce.jgit.transport.RemoteConfig getSubmoduleRepository(java.io.File aWorkspace, org.spearce.jgit.transport.RemoteConfig orig, java.lang.String name)
           
 boolean getWipeOutWorkspace()
           
 boolean pollChanges(hudson.model.AbstractProject project, hudson.Launcher launcher, hudson.FilePath workspace, hudson.model.TaskListener listener)
           
 java.lang.Object readResolve()
           
 void setSubmoduleCfg(java.util.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
_for, all, createEmptyChangeLog, getApi, getDescriptor, getEffectiveBrowser, getModuleRoot, getModuleRoots, getType, nullify, processWorkspaceBeforeDeletion, requiresWorkspaceForPolling, supportsPolling
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gitTool

public java.lang.String gitTool

GIT_BRANCH

public static final java.lang.String GIT_BRANCH
See Also:
Constant Field Values

GIT_COMMIT

public static final java.lang.String GIT_COMMIT
See Also:
Constant Field Values
Constructor Detail

GitSCM

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

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

GitSCM

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

getSubmoduleCfg

public java.util.Collection<SubmoduleConfig> getSubmoduleCfg()

setSubmoduleCfg

public void setSubmoduleCfg(java.util.Collection<SubmoduleConfig> submoduleCfg)

readResolve

public java.lang.Object readResolve()

getExcludedRegions

public java.lang.String getExcludedRegions()

getExcludedRegionsNormalized

public java.lang.String[] getExcludedRegionsNormalized()

getExcludedUsers

public java.lang.String getExcludedUsers()

getExcludedUsersNormalized

public java.util.Set<java.lang.String> getExcludedUsersNormalized()

getBrowser

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

getPruneBranches

public boolean getPruneBranches()

getWipeOutWorkspace

public boolean getWipeOutWorkspace()

getClean

public boolean getClean()

getBuildChooser

public BuildChooser getBuildChooser()

getParamExpandedRepos

public java.util.List<org.spearce.jgit.transport.RemoteConfig> getParamExpandedRepos(hudson.model.AbstractBuild<?,?> build)

getRepositoryByName

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

getRepositories

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

getGitTool

public java.lang.String getGitTool()

pollChanges

public boolean pollChanges(hudson.model.AbstractProject project,
                           hudson.Launcher launcher,
                           hudson.FilePath workspace,
                           hudson.model.TaskListener listener)
                    throws java.io.IOException,
                           java.lang.InterruptedException
Specified by:
pollChanges in class hudson.scm.SCM
Throws:
java.io.IOException
java.lang.InterruptedException

getSubmoduleRepository

public org.spearce.jgit.transport.RemoteConfig getSubmoduleRepository(java.io.File aWorkspace,
                                                                      org.spearce.jgit.transport.RemoteConfig orig,
                                                                      java.lang.String name)
                                                               throws java.io.IOException
Throws:
java.io.IOException

getGitExe

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


getAuthorOrCommitter

public boolean getAuthorOrCommitter()
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,
                        java.io.File changelogFile)
                 throws java.io.IOException,
                        java.lang.InterruptedException
Specified by:
checkout in class hudson.scm.SCM
Throws:
java.io.IOException
java.lang.InterruptedException

buildEnvVars

public void buildEnvVars(hudson.model.AbstractBuild build,
                         java.util.Map<java.lang.String,java.lang.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 java.util.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 -
clone -
Returns:
the last recorded build data

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

getLocalBranch

public java.lang.String getLocalBranch()

getRelativeTargetDir

public java.lang.String getRelativeTargetDir()


Copyright © 2010. All Rights Reserved.