public class GitSCM extends GitSCMBackwardCompatibility
| Modifier and Type | Class and Description |
|---|---|
static class |
GitSCM.DescriptorImpl |
ExtensionPoint.LegacyInstancesAreScopedToHudson| Modifier and Type | Field and Description |
|---|---|
static String |
GIT_BRANCH |
static String |
GIT_CHECKOUT_DIR |
static String |
GIT_COMMIT |
static String |
GIT_LOCAL_BRANCH |
static String |
GIT_PREVIOUS_COMMIT |
static String |
GIT_PREVIOUS_SUCCESSFUL_COMMIT |
static Pattern |
GIT_REF |
String |
gitTool |
static int |
MAX_CHANGELOG
To avoid pointlessly large changelog, we'll limit the number of changes up to this.
|
static boolean |
VERBOSE
Set to true to enable more logging to build's
TaskListener. |
PERMISSIONS, TAG| Constructor and Description |
|---|
GitSCM(List<UserRemoteConfig> userRemoteConfigs,
List<BranchSpec> branches,
Boolean doGenerateSubmoduleConfigurations,
Collection<SubmoduleConfig> submoduleCfg,
GitRepositoryBrowser browser,
String gitTool,
List<GitSCMExtension> extensions) |
GitSCM(String repositoryUrl)
A convenience constructor that sets everything to default.
|
| Modifier and Type | Method and Description |
|---|---|
void |
buildEnvironment(Run<?,?> build,
Map<String,String> env) |
void |
buildEnvVars(AbstractBuild<?,?> build,
Map<String,String> env)
Deprecated.
|
SCMRevisionState |
calcRevisionsFromBuild(Run<?,?> abstractBuild,
FilePath workspace,
Launcher launcher,
TaskListener taskListener) |
void |
checkout(Run<?,?> build,
Launcher launcher,
FilePath workspace,
TaskListener listener,
File changelogFile,
SCMRevisionState baseline) |
PollingResult |
compareRemoteRevisionWith(Job<?,?> project,
Launcher launcher,
FilePath workspace,
TaskListener listener,
SCMRevisionState baseline) |
static void |
configureXtream() |
BuildData |
copyBuildData(Run build)
Like
getBuildData(Run), but copy the data into a new object,
which is used as the first step for updating the data for the next build. |
ChangeLogParser |
createChangeLogParser() |
org.jenkinsci.plugins.gitclient.GitClient |
createClient(TaskListener listener,
EnvVars environment,
Run<?,?> build,
FilePath workspace)
|
org.jenkinsci.plugins.gitclient.GitClient |
createClient(TaskListener listener,
EnvVars environment,
Run<?,?> build,
FilePath workspace,
org.jenkinsci.plugins.gitclient.UnsupportedCommand postBuildUnsupportedCommand)
Allows
Publisher and other post build actions to access a configured GitClient. |
static List<UserRemoteConfig> |
createRepoList(String url,
String credentialsId) |
String |
deriveLocalBranchName(String remoteBranchName)
Derives a local branch name from the remote branch name by removing the
name of the remote from the remote branch name.
|
List<BranchSpec> |
getBranches() |
GitRepositoryBrowser |
getBrowser() |
BuildChooser |
getBuildChooser() |
BuildData |
getBuildData(Run build)
Find the build log (BuildData) recorded with the last build that completed.
|
BuildData |
getBuildData(Run build,
boolean clone)
Deprecated.
|
DescribableList<GitSCMExtension,GitSCMExtensionDescriptor> |
getExtensions()
All the configured extensions attached to this
GitSCM. |
String |
getGitExe(Node builtOn,
EnvVars env,
TaskListener listener)
Exposing so that we can get this from GitPublisher.
|
String |
getGitExe(Node builtOn,
TaskListener listener) |
String |
getGitTool() |
hudson.plugins.git.GitTool |
getGitTool(Node builtOn,
EnvVars env,
TaskListener listener) |
String |
getKey() |
PreBuildMergeOptions |
getMergeOptions()
Deprecated.
Use
PreBuildMerge. |
static String |
getParameterString(String original,
EnvVars env) |
org.eclipse.jgit.transport.RemoteConfig |
getParamExpandedRepo(EnvVars env,
org.eclipse.jgit.transport.RemoteConfig remoteRepository)
Expand Parameters in the supplied remote repository with the parameter values provided in the given environment variables }
|
List<org.eclipse.jgit.transport.RemoteConfig> |
getParamExpandedRepos(Run<?,?> build)
Deprecated.
|
List<org.eclipse.jgit.transport.RemoteConfig> |
getParamExpandedRepos(Run<?,?> build,
TaskListener listener)
Expand parameters in
remoteRepositories with the parameter values provided in the given build
and return them. |
String |
getParamLocalBranch(Run<?,?> build)
Deprecated.
|
String |
getParamLocalBranch(Run<?,?> build,
TaskListener listener)
Gets the parameter-expanded effective value in the context of the current build.
|
List<org.eclipse.jgit.transport.RemoteConfig> |
getRepositories() |
org.eclipse.jgit.transport.RemoteConfig |
getRepositoryByName(String repoName) |
Collection<SubmoduleConfig> |
getSubmoduleCfg() |
List<UserRemoteConfig> |
getUserRemoteConfigs() |
RepositoryBrowser<?> |
guessBrowser() |
boolean |
isAllowSecondFetch() |
boolean |
isCreateAccountBasedOnEmail() |
boolean |
isDisableGitToolChooser() |
boolean |
isDoGenerateSubmoduleConfigurations() |
boolean |
isHideCredentials() |
boolean |
isUseExistingAccountWithSameEmail() |
static void |
onLoaded() |
Object |
readResolve() |
boolean |
requiresWorkspaceForPolling() |
hudson.plugins.git.GitTool |
resolveGitTool(TaskListener listener) |
void |
setBrowser(GitRepositoryBrowser browser) |
void |
setBuildChooser(BuildChooser buildChooser) |
void |
setSubmoduleCfg(Collection<SubmoduleConfig> submoduleCfg) |
protected FilePath |
workingDirectory(Job<?,?> context,
FilePath workspace,
EnvVars environment,
TaskListener listener)
Given the workspace, gets the working directory, which will be the workspace
if no relative target dir is specified.
|
getAuthorOrCommitter, getClean, getDescriptor, getDisableSubmodules, getExcludedRegions, getExcludedRegionsNormalized, getExcludedUsers, getExcludedUsersNormalized, getGitConfigEmail, getGitConfigEmailToUse, getGitConfigName, getGitConfigNameToUse, getIncludedRegions, getIncludedRegionsNormalized, getLocalBranch, getPruneBranches, getRecursiveSubmodules, getReference, getRelativeTargetDir, getRemotePoll, getScmName, getSkipTag, getTrackingSubmodules, getUserMergeOptions, getUseShallowClone, getWipeOutWorkspace, isIgnoreNotifyCommit_calcRevisionsFromBuild, _for, _for, all, calcRevisionsFromBuild, checkout, compareRemoteRevisionWith, createEmptyChangeLog, createEmptyChangeLog, getApi, getEffectiveBrowser, getModuleRoot, getModuleRoot, getModuleRoots, getModuleRoots, getType, nullify, poll, pollChanges, postCheckout, postCheckout, processWorkspaceBeforeDeletion, processWorkspaceBeforeDeletion, supportsPolling@CheckForNull public String gitTool
public static final String GIT_BRANCH
public static final String GIT_LOCAL_BRANCH
public static final String GIT_CHECKOUT_DIR
public static final String GIT_COMMIT
public static final String GIT_PREVIOUS_COMMIT
public static final String GIT_PREVIOUS_SUCCESSFUL_COMMIT
public static final Pattern GIT_REF
public static boolean VERBOSE
TaskListener.
Used by various classes in this package.public static final int MAX_CHANGELOG
public GitSCM(String repositoryUrl)
repositoryUrl - git repository URL
Repository URL to clone from.@DataBoundConstructor public GitSCM(List<UserRemoteConfig> userRemoteConfigs, List<BranchSpec> branches, Boolean doGenerateSubmoduleConfigurations, Collection<SubmoduleConfig> submoduleCfg, @CheckForNull GitRepositoryBrowser browser, @CheckForNull String gitTool, List<GitSCMExtension> extensions)
public Collection<SubmoduleConfig> getSubmoduleCfg()
public void setSubmoduleCfg(Collection<SubmoduleConfig> submoduleCfg)
public static List<UserRemoteConfig> createRepoList(String url, String credentialsId)
public DescribableList<GitSCMExtension,GitSCMExtensionDescriptor> getExtensions()
GitSCM.
Going forward this is primarily how we'll support esoteric use cases.public Object readResolve() throws IOException
IOExceptionpublic GitRepositoryBrowser getBrowser()
getBrowser in class SCMpublic void setBrowser(GitRepositoryBrowser browser)
public RepositoryBrowser<?> guessBrowser()
guessBrowser in class SCMpublic boolean isCreateAccountBasedOnEmail()
public boolean isUseExistingAccountWithSameEmail()
public boolean isHideCredentials()
public boolean isAllowSecondFetch()
public boolean isDisableGitToolChooser()
public BuildChooser getBuildChooser()
public void setBuildChooser(BuildChooser buildChooser) throws IOException
IOException@Deprecated public String getParamLocalBranch(Run<?,?> build) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic String getParamLocalBranch(Run<?,?> build, TaskListener listener) throws IOException, InterruptedException
build - run whose local branch name is returnedlistener - build logIOException - on input or output errorInterruptedException - when interrupted@Deprecated public List<org.eclipse.jgit.transport.RemoteConfig> getParamExpandedRepos(Run<?,?> build) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic List<org.eclipse.jgit.transport.RemoteConfig> getParamExpandedRepos(Run<?,?> build, TaskListener listener) throws IOException, InterruptedException
remoteRepositories with the parameter values provided in the given build
and return them.build - run whose local branch name is returnedlistener - build logIOException - on input or output errorInterruptedException - when interruptedpublic org.eclipse.jgit.transport.RemoteConfig getParamExpandedRepo(EnvVars env, org.eclipse.jgit.transport.RemoteConfig remoteRepository)
env - Environment variables with parameter valuesremoteRepository - Remote repository with parameterspublic org.eclipse.jgit.transport.RemoteConfig getRepositoryByName(String repoName)
@Exported public List<UserRemoteConfig> getUserRemoteConfigs()
public List<org.eclipse.jgit.transport.RemoteConfig> getRepositories()
public String deriveLocalBranchName(String remoteBranchName)
Ex. origin/master becomes master
Cycles through the list of user remotes looking for a match allowing user to configure an alternate (not origin) name for the remote.
remoteBranchName - branch name whose remote repository name will be removedremoteBranchName parameter. If a matching
remote is not found, the original remoteBranchName will
be returned.@CheckForNull public String getGitTool()
@NonNull public static String getParameterString(@CheckForNull String original, @NonNull EnvVars env)
public SCMRevisionState calcRevisionsFromBuild(Run<?,?> abstractBuild, FilePath workspace, Launcher launcher, TaskListener taskListener) throws IOException, InterruptedException
calcRevisionsFromBuild in class SCMIOExceptionInterruptedExceptionpublic boolean requiresWorkspaceForPolling()
requiresWorkspaceForPolling in class SCMpublic PollingResult compareRemoteRevisionWith(Job<?,?> project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline) throws IOException, InterruptedException
compareRemoteRevisionWith in class SCMIOExceptionInterruptedException@NonNull public org.jenkinsci.plugins.gitclient.GitClient createClient(TaskListener listener, EnvVars environment, Run<?,?> build, FilePath workspace) throws IOException, InterruptedException
Builders and Publishers to access a configured GitClient object to
perform additional git operations.listener - build logenvironment - environment variables to be usedbuild - run context for the returned GitClientworkspace - client workspaceIOException - on input or output errorInterruptedException - when interrupted@NonNull public org.jenkinsci.plugins.gitclient.GitClient createClient(TaskListener listener, EnvVars environment, Run<?,?> build, FilePath workspace, org.jenkinsci.plugins.gitclient.UnsupportedCommand postBuildUnsupportedCommand) throws IOException, InterruptedException
Publisher and other post build actions to access a configured GitClient.
The post build action can use the postBuildUnsupportedCommand argument to control the
selection of a git tool by GitToolChooser.listener - build logenvironment - environment variables to be usedbuild - run context for the returned GitClientworkspace - client workspacepostBuildUnsupportedCommand - passed by caller to control choice of git tool by GitTooChooserIOException - on input or output errorInterruptedException - when interrupted@CheckForNull public hudson.plugins.git.GitTool resolveGitTool(TaskListener listener)
public String getGitExe(Node builtOn, TaskListener listener)
public String getGitExe(Node builtOn, EnvVars env, TaskListener listener)
builtOn - node where build was performedenv - environment variables used in the buildlistener - build logpublic hudson.plugins.git.GitTool getGitTool(Node builtOn, EnvVars env, TaskListener listener)
public void checkout(Run<?,?> build, Launcher launcher, FilePath workspace, TaskListener listener, File changelogFile, SCMRevisionState baseline) throws IOException, InterruptedException
checkout in class SCMIOExceptionInterruptedException@Deprecated public void buildEnvVars(AbstractBuild<?,?> build, Map<String,String> env)
buildEnvVars in class SCMpublic void buildEnvironment(Run<?,?> build, Map<String,String> env)
buildEnvironment in class SCMpublic ChangeLogParser createChangeLogParser()
createChangeLogParser in class SCMpublic boolean isDoGenerateSubmoduleConfigurations()
@Exported public List<BranchSpec> getBranches()
@Exported @Deprecated public PreBuildMergeOptions getMergeOptions() throws Descriptor.FormException
PreBuildMerge.Descriptor.FormException - on form errorpublic BuildData getBuildData(Run build, boolean clone)
build - run whose build data is returnedclone - true if returned build data should be copied rather than referencedpublic BuildData copyBuildData(Run build)
getBuildData(Run), but copy the data into a new object,
which is used as the first step for updating the data for the next build.build - run whose BuildData is returned@CheckForNull public BuildData getBuildData(Run build)
build - run whose build data is returnedprotected FilePath workingDirectory(Job<?,?> context, FilePath workspace, EnvVars environment, TaskListener listener) throws IOException, InterruptedException
context - job context for working directoryworkspace - initial FilePath of job workspaceenvironment - environment variables used in job contextlistener - build logIOException - on input or output errorInterruptedException - when interrupted@Initializer(after=PLUGINS_STARTED) public static void onLoaded()
@Initializer(before=JOB_LOADED) public static void configureXtream()
Copyright © 2007–2020. All rights reserved.