@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(com.atlassian.sal.api.message.I18nResolver i18nResolver,
BuildLogger buildLogger,
SshProxyService sshProxyService,
HgRepository repository,
ScopedExclusionService exclusionService,
TrustedKeyHelper trustedKeyHelper) |
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...
|
BuildRepositoryChanges |
collectChangesSinceLastBuild(File cacheDirectory,
String previousVcsRevisionKey,
int maxCommitsToReturn)
Checks whether remote repository has newer revision(s).
|
String |
getDefaultSshCommand() |
CommitContext |
getFirstCommit(File cacheDirectory) |
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 |
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(com.atlassian.sal.api.message.I18nResolver i18nResolver, BuildLogger buildLogger, SshProxyService sshProxyService, HgRepository repository, ScopedExclusionService exclusionService, TrustedKeyHelper trustedKeyHelper) 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
public CommitContext getFirstCommit(@NotNull File cacheDirectory) throws RepositoryException
getFirstCommit
in interface HgRepositoryAccess
RepositoryException
@NotNull public String getLatestRemoteRevisionHash(@NotNull File workingDirectory) throws RepositoryException
HgRepositoryAccess
getLatestRemoteRevisionHash
in interface HgRepositoryAccess
workingDirectory
- working directory to execute commandRepositoryException
- on any errorCopyright © 2016 Atlassian Software Systems Pty Ltd. All rights reserved.