public class GitWorkingCopyManager extends AbstractGitExecutor implements MergingVcsWorkingCopyManager, UpdatingVcsWorkingCopyManager, NoContextVcsWorkingCopyManager, StatusProvidingVcsWorkingCopyManager
buildDirectoryManager, customVariableContext, DEFAULT_BRANCH, i18nResolver, sshProxyService, trustedKeyHelper
Constructor and Description |
---|
GitWorkingCopyManager(CapabilityContext capabilityContext,
CredentialsAccessor credentialsAccessor,
CustomVariableContext customVariableContext,
BuildDirectoryManager buildDirectoryManager,
com.atlassian.sal.api.message.I18nResolver i18nResolver,
TrustedKeyHelper trustedKeyHelper,
SshProxyService sshProxyService,
BuildLoggerManager buildLoggerManager,
VcsBranchIntegrationHelper branchIntegrationHelper) |
Modifier and Type | Method and Description |
---|---|
boolean |
canDoMerge() |
VcsWorkingCopy |
checkoutAndMerge(CommonContext commonContext,
VcsRepositoryData vcsRepositoryData,
VcsBranch targetBranch,
PlanVcsRevisionData revisionOnTarget,
VcsBranch sourceBranch,
PlanVcsRevisionData sourceRevision,
File targetPath)
Checks out the targetBranch and merges sourceBranch to it.
|
VcsWorkingCopy |
commitLocal(VcsWorkingCopy workingCopy,
VcsRepositoryData vcsRepositoryData,
String commitMessage)
Create a local commit.
|
Set<Requirement> |
getMergingRequirements()
If executing merge imposes capability requirements on top of those
returned by
VcsExecutorWithRequirements#getRequirements() , return them here. |
VcsWorkingCopy |
getWorkingCopyInfo(VcsRepositoryData repositoryData,
File checkoutPath)
Provide repository working copy information for the given checkout path.
|
VcsWorkingCopy |
retrieveSourceCode(CommonContext commonContext,
VcsRepositoryData repositoryData,
PlanVcsRevisionData targetRevision,
File targetPath)
Checkout or update a working copy to a revision.
|
void |
stageChanges(VcsWorkingCopy workingCopy,
VcsRepositoryData repositoryData,
Collection<String> pathsToAdd)
Stage changes for committing.
|
VcsWorkingCopy |
updateRemote(VcsWorkingCopy workingCopy,
VcsRepositoryData vcsRepositoryData,
String commitMessage)
Update remote repository.
|
VcsWorkingCopy |
updateToLatestRevision(CommonContext commonContext,
VcsRepositoryData repositoryData,
File targetPath)
Checkout or update a working copy to the latest revision.
|
VcsWorkingCopy |
updateToLatestRevision(VcsRepositoryData repositoryData,
File targetPath)
Checkout or update a working copy to the latest revision.
|
getAccessData, getCacheDirectory, getCachePath, getGitCapability, getSharedCredentialsIdField, getSshCapability, getSubstitutedAccessData, getSubstitutedAccessDataBuilder, getWorkingDirectory, isUsingSharedCredentials, rethrowOrRemoveDirectory, substituteString
@Inject public GitWorkingCopyManager(CapabilityContext capabilityContext, CredentialsAccessor credentialsAccessor, CustomVariableContext customVariableContext, BuildDirectoryManager buildDirectoryManager, com.atlassian.sal.api.message.I18nResolver i18nResolver, TrustedKeyHelper trustedKeyHelper, SshProxyService sshProxyService, BuildLoggerManager buildLoggerManager, VcsBranchIntegrationHelper branchIntegrationHelper)
@NotNull public VcsWorkingCopy getWorkingCopyInfo(@NotNull VcsRepositoryData repositoryData, @NotNull File checkoutPath) throws RepositoryException
StatusProvidingVcsWorkingCopyManager
getWorkingCopyInfo
in interface StatusProvidingVcsWorkingCopyManager
repositoryData
- configuration of the repositorycheckoutPath
- path, where repository was checked outRepositoryException
- if any error occurs, or e.g. the path is not a valid checkout path for the
repository@NotNull public VcsWorkingCopy retrieveSourceCode(@NotNull CommonContext commonContext, @NotNull VcsRepositoryData repositoryData, @NotNull PlanVcsRevisionData targetRevision, @NotNull File targetPath) throws RepositoryException
VcsWorkingCopyManager
retrieveSourceCode
in interface VcsWorkingCopyManager
commonContext
- - a current build or deployment contextrepositoryData
- - configuration of a repository to checkout/updatetargetRevision
- - revision to check out or update totargetPath
- - workings copy's path. Note that some legacy implementation may ignore this parameter. (see FixedDirectoryWorkingCopyManager
)RepositoryException
@NotNull public VcsWorkingCopy updateToLatestRevision(@NotNull CommonContext commonContext, @NotNull VcsRepositoryData repositoryData, @NotNull File targetPath) throws RepositoryException
VcsWorkingCopyManager
updateToLatestRevision
in interface VcsWorkingCopyManager
commonContext
- - a current build or deployment contextrepositoryData
- - configuration of a repository to checkout/updatetargetPath
- - workings copy's path. Note that some legacy implementation may ignore this parameter. (see FixedDirectoryWorkingCopyManager
)RepositoryException
@NotNull public VcsWorkingCopy updateToLatestRevision(@NotNull VcsRepositoryData repositoryData, @NotNull File targetPath) throws RepositoryException
NoContextVcsWorkingCopyManager
updateToLatestRevision
in interface NoContextVcsWorkingCopyManager
repositoryData
- - configuration of a repository to checkout/updatetargetPath
- - workings copy's path. Note that some legacy implementation may ignore this parameter. (see FixedDirectoryWorkingCopyManager
)RepositoryException
@NotNull public VcsWorkingCopy checkoutAndMerge(@NotNull CommonContext commonContext, @NotNull VcsRepositoryData vcsRepositoryData, @NotNull VcsBranch targetBranch, @NotNull PlanVcsRevisionData revisionOnTarget, @NotNull VcsBranch sourceBranch, @NotNull PlanVcsRevisionData sourceRevision, @NotNull File targetPath) throws RepositoryException
MergingVcsWorkingCopyManager
checkoutAndMerge
in interface MergingVcsWorkingCopyManager
vcsRepositoryData
- configuration of the repository. Note that the following parameters override branch stored in repository data.targetBranch
- - target branch (branch to checkout and merge to)revisionOnTarget
- - revision to checkout and merge tosourceBranch
- - branch to merge fromsourceRevision
- - revision to merge fromtargetPath
- - workings copy's pathRepositoryException
public boolean canDoMerge()
canDoMerge
in interface MergingVcsWorkingCopyManager
@NotNull public Set<Requirement> getMergingRequirements()
MergingVcsWorkingCopyManager
VcsExecutorWithRequirements#getRequirements()
, return them here.getMergingRequirements
in interface MergingVcsWorkingCopyManager
public void stageChanges(@NotNull VcsWorkingCopy workingCopy, @NotNull VcsRepositoryData repositoryData, @NotNull Collection<String> pathsToAdd) throws RepositoryException
UpdatingVcsWorkingCopyManager
Staging logic may differ between repository types. As an example, in Git it is necessary to stage added, modified and removed files before committing. In Mercurial on the other hand, only added and removed files need to be staged (modified files will be committed regardless, as they are considered tracked by the VCS).
stageChanges
in interface UpdatingVcsWorkingCopyManager
workingCopy
- workspace to perform the stagingrepositoryData
- configuration of repositorypathsToAdd
- paths, relative to working copy directory, to stage for committing; if empty, all modified
files from working copy directory should be stagedRepositoryException
@NotNull public VcsWorkingCopy commitLocal(@NotNull VcsWorkingCopy workingCopy, @NotNull VcsRepositoryData vcsRepositoryData, @NotNull String commitMessage) throws RepositoryException
UpdatingVcsWorkingCopyManager
commitLocal
in interface UpdatingVcsWorkingCopyManager
RepositoryException
@NotNull public VcsWorkingCopy updateRemote(@NotNull VcsWorkingCopy workingCopy, @NotNull VcsRepositoryData vcsRepositoryData, @Nullable String commitMessage) throws RepositoryException
UpdatingVcsWorkingCopyManager
updateRemote
in interface UpdatingVcsWorkingCopyManager
commitMessage
- - implementors are free to ignore this parameter.RepositoryException
Copyright © 2020 Atlassian Software Systems Pty Ltd. All rights reserved.