@NotThreadSafe public class HgRepositoryAccessImpl extends Object implements HgRepositoryAccess
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_SSH_COMMAND |
static SecureTemporaryFiles.FileSpecBuilder |
TEMPORARY_FILE_SPEC |
Constructor and Description |
---|
HgRepositoryAccessImpl(HgRepositoryAccessData substitutedAccessData,
BuildLogger buildLogger,
com.atlassian.sal.api.message.I18nResolver i18nResolver,
SshProxyService sshProxyService,
ScopedExclusionService exclusionService,
TrustedKeyHelper trustedKeyHelper,
CapabilityContext capabilityContext,
File workingDirectory) |
HgRepositoryAccessImpl(HgRepository repository,
BuildLogger buildLogger,
com.atlassian.sal.api.message.I18nResolver i18nResolver,
SshProxyService sshProxyService,
ScopedExclusionService exclusionService,
TrustedKeyHelper trustedKeyHelper,
CapabilityContext capabilityContext) |
Modifier and Type | Method and Description |
---|---|
void |
archiveSourceCode(File destinationDirectory,
File cacheDirectory,
String vcsRevision,
String[] includePattern)
"Archive" (as in svn export) contents of specified revision, applying specified --include pattern
|
void |
close()
Cleans up resources, connections, etc...
|
void |
collectChangesetsBetweenRevisions(BuildRepositoryChanges buildChanges,
File planDirectory,
String previousVcsRevisionKey,
String targetRevision,
int maxCommitsToReturn) |
BuildRepositoryChanges |
collectChangesSinceLastBuild(File cacheDirectory,
String previousVcsRevisionKey,
int maxCommitsToReturn)
Checks whether remote repository has newer revision(s).
|
String |
getDefaultSshCommand() |
String |
getDisplayName(AuthenticationType authenticationType) |
CommitContext |
getFirstCommit(File cacheDirectory) |
HgCommandProcessor |
getHgCommandProcessor() |
String |
getHgExeCapability() |
CommitContext |
getLastCommit(File cacheDirectory) |
String |
getLatestRemoteRevisionHash(File workingDirectory)
Returns the latest 40-character hash code of the tip-most change set in remote repository.
|
String |
getProxiedUrl(String connectionDescription) |
URI |
getRemoteUri() |
HgRepositoryAccessData |
getSubstitutedAccessData() |
void |
pullToLocalDirectory(File directory,
String repositoryUrl,
String targetRevision) |
String |
retrieveSourceCode(File sourceDirectory,
File cacheDirectory,
String vcsRevision)
Updates sources in sourceDirectory from remote repository to targetRevision.
|
String |
retrieveSourceCode(File sourceDirectory,
File cacheDirectory,
String vcsRevision,
int attempt) |
public static final String DEFAULT_SSH_COMMAND
public static final SecureTemporaryFiles.FileSpecBuilder TEMPORARY_FILE_SPEC
public HgRepositoryAccessImpl(HgRepository repository, BuildLogger buildLogger, com.atlassian.sal.api.message.I18nResolver i18nResolver, SshProxyService sshProxyService, ScopedExclusionService exclusionService, TrustedKeyHelper trustedKeyHelper, CapabilityContext capabilityContext) throws RepositoryException
RepositoryException
public HgRepositoryAccessImpl(HgRepositoryAccessData substitutedAccessData, BuildLogger buildLogger, com.atlassian.sal.api.message.I18nResolver i18nResolver, SshProxyService sshProxyService, ScopedExclusionService exclusionService, TrustedKeyHelper trustedKeyHelper, CapabilityContext capabilityContext, File workingDirectory) throws RepositoryException
RepositoryException
public String getDefaultSshCommand()
public BuildRepositoryChanges collectChangesSinceLastBuild(@NotNull File cacheDirectory, @Nullable String previousVcsRevisionKey, int maxCommitsToReturn) throws RepositoryException
HgRepositoryAccess
collectChangesSinceLastBuild
in interface HgRepositoryAccess
cacheDirectory
- specifies where to store updated repository. Perfectly it should be the 'cache' directory
holding shared repository for all plans using the same repository URLpreviousVcsRevisionKey
- specifies since which revision we want to collect changesetsRepositoryException
public String retrieveSourceCode(@NotNull File sourceDirectory, @Nullable File cacheDirectory, @Nullable String vcsRevision) throws RepositoryException
HgRepositoryAccess
retrieveSourceCode
in interface HgRepositoryAccess
sourceDirectory
- specifies where we want to retrieve sourcescacheDirectory
- specifies where is kept local cache directory, which will hold presumably a more updated repository than sourceDirectory.vcsRevision
- specifies since which revision we want to collect changesetsRepositoryException
public String retrieveSourceCode(@NotNull File sourceDirectory, @Nullable File cacheDirectory, @Nullable String vcsRevision, int attempt) throws RepositoryException
RepositoryException
public void archiveSourceCode(@NotNull File destinationDirectory, @NotNull File cacheDirectory, @NotNull String vcsRevision, @Nullable String[] includePattern) throws RepositoryException
HgRepositoryAccess
Differs from {link #retrieveSourceCode} by not cloning the repository first (think "svn checkout" vs. "svn export")
archiveSourceCode
in interface HgRepositoryAccess
destinationDirectory
- directory to extract files tocacheDirectory
- local repository to extract fromvcsRevision
- revision to extract, tip if nullincludePattern
- include patterns to limit extracted files, all files if null or emptyRepositoryException
- on any errorpublic void close()
HgRepositoryAccess
close
in interface HgRepositoryAccess
public CommitContext getLastCommit(@NotNull File cacheDirectory) throws RepositoryException
getLastCommit
in interface HgRepositoryAccess
RepositoryException
@NotNull public CommitContext getFirstCommit(@NotNull File cacheDirectory) throws RepositoryException
getFirstCommit
in interface HgRepositoryAccess
RepositoryException
public void collectChangesetsBetweenRevisions(@NotNull BuildRepositoryChanges buildChanges, File planDirectory, String previousVcsRevisionKey, String targetRevision, int maxCommitsToReturn) throws RepositoryException
RepositoryException
public void pullToLocalDirectory(@NotNull File directory, @NotNull String repositoryUrl, @Nullable String targetRevision) throws RepositoryException
RepositoryException
@NotNull public String getLatestRemoteRevisionHash(@NotNull File workingDirectory) throws RepositoryException
HgRepositoryAccess
getLatestRemoteRevisionHash
in interface HgRepositoryAccess
workingDirectory
- working directory to execute commandRepositoryException
- on any error@Nullable public URI getRemoteUri()
@NotNull public String getProxiedUrl(@Nullable String connectionDescription) throws RepositoryException
RepositoryException
public String getDisplayName(AuthenticationType authenticationType)
AuthenticationType
@Nullable public String getHgExeCapability()
public HgCommandProcessor getHgCommandProcessor()
public HgRepositoryAccessData getSubstitutedAccessData()
Copyright © 2020 Atlassian Software Systems Pty Ltd. All rights reserved.