public class GitContentRepositoryHelper extends Object
Modifier and Type | Field and Description |
---|---|
protected org.eclipse.jgit.lib.Repository |
globalRepo |
protected Map<String,org.eclipse.jgit.lib.Repository> |
published |
protected Map<String,org.eclipse.jgit.lib.Repository> |
sandboxes |
protected SecurityProvider |
securityProvider |
protected ServicesConfig |
servicesConfig |
protected StudioConfiguration |
studioConfiguration |
Modifier and Type | Method and Description |
---|---|
boolean |
buildGlobalRepo()
Build the global repository as part of system startup and caches it
|
Path |
buildRepoPath(GitRepositories repoType) |
Path |
buildRepoPath(GitRepositories repoType,
String site) |
boolean |
buildSiteRepo(String site)
Builds a site's repository objects and caches them (Sandbox and Published)
|
boolean |
bulkImport(String site) |
String |
commitFile(org.eclipse.jgit.lib.Repository repo,
String site,
String path,
String comment,
org.eclipse.jgit.lib.PersonIdent user) |
boolean |
copyContentFromBlueprint(String blueprint,
String site) |
org.eclipse.jgit.lib.Repository |
createGitRepository(Path path) |
boolean |
createGlobalRepo() |
boolean |
createSiteCloneRemoteGitRepo(String siteId,
String sandboxBranch,
String remoteName,
String remoteUrl,
String remoteBranch,
boolean singleBranch,
String authenticationType,
String remoteUsername,
String remotePassword,
String remoteToken,
String remotePrivateKey) |
boolean |
createSiteGitRepo(String site,
String sandboxBranch)
Create a site git repository from scratch (Sandbox and Published)
|
boolean |
deleteSiteGitRepo(String site) |
org.eclipse.jgit.lib.PersonIdent |
getAuthorIdent(String author)
Return the author identity as a jgit PersonIdent
|
org.eclipse.jgit.lib.PersonIdent |
getCurrentUserIdent()
Return the current user identity as a jgit PersonIdent
|
List<String> |
getFilesInCommit(org.eclipse.jgit.lib.Repository repository,
org.eclipse.jgit.revwalk.RevCommit commit) |
String |
getGitPath(String path) |
org.eclipse.jgit.lib.Repository |
getRepository(String site,
GitRepositories gitRepository) |
org.eclipse.jgit.lib.Repository |
getRepository(String site,
GitRepositories gitRepository,
String sandboxBranch) |
org.eclipse.jgit.revwalk.RevTree |
getTreeForCommit(org.eclipse.jgit.lib.Repository repository,
String commitId) |
org.eclipse.jgit.revwalk.RevTree |
getTreeForLastCommit(org.eclipse.jgit.lib.Repository repository) |
org.eclipse.jgit.lib.Repository |
openRepository(Path repositoryPath)
Opens a git repository
|
boolean |
performInitialCommit(String site,
String message,
String sandboxBranch)
Perform an initial commit after large changes to a site.
|
protected boolean |
replaceSitenameVariable(String site,
Path path) |
boolean |
updateSitenameConfigVar(String site) |
boolean |
writeFile(org.eclipse.jgit.lib.Repository repo,
String site,
String path,
InputStream content) |
protected org.eclipse.jgit.lib.Repository globalRepo
protected StudioConfiguration studioConfiguration
protected SecurityProvider securityProvider
protected ServicesConfig servicesConfig
public boolean buildGlobalRepo() throws IOException
IOException
public boolean buildSiteRepo(String site)
site
- path to repositorypublic org.eclipse.jgit.lib.Repository openRepository(Path repositoryPath) throws IOException
repositoryPath
- path to repository to open (including .git)IOException
public org.eclipse.jgit.lib.Repository createGitRepository(Path path)
public Path buildRepoPath(GitRepositories repoType)
public Path buildRepoPath(GitRepositories repoType, String site)
public boolean createSiteGitRepo(String site, String sandboxBranch)
site
- public boolean createGlobalRepo()
public boolean deleteSiteGitRepo(String site)
public boolean updateSitenameConfigVar(String site)
public boolean bulkImport(String site)
public boolean performInitialCommit(String site, String message, String sandboxBranch)
site
- message
- public org.eclipse.jgit.lib.Repository getRepository(String site, GitRepositories gitRepository)
public org.eclipse.jgit.lib.Repository getRepository(String site, GitRepositories gitRepository, String sandboxBranch)
public org.eclipse.jgit.revwalk.RevTree getTreeForLastCommit(org.eclipse.jgit.lib.Repository repository) throws org.eclipse.jgit.errors.AmbiguousObjectException, org.eclipse.jgit.errors.IncorrectObjectTypeException, IOException, org.eclipse.jgit.errors.MissingObjectException
org.eclipse.jgit.errors.AmbiguousObjectException
org.eclipse.jgit.errors.IncorrectObjectTypeException
IOException
org.eclipse.jgit.errors.MissingObjectException
public org.eclipse.jgit.revwalk.RevTree getTreeForCommit(org.eclipse.jgit.lib.Repository repository, String commitId) throws IOException
IOException
public boolean writeFile(org.eclipse.jgit.lib.Repository repo, String site, String path, InputStream content)
public String commitFile(org.eclipse.jgit.lib.Repository repo, String site, String path, String comment, org.eclipse.jgit.lib.PersonIdent user)
public org.eclipse.jgit.lib.PersonIdent getCurrentUserIdent()
public org.eclipse.jgit.lib.PersonIdent getAuthorIdent(String author)
author
- authorpublic List<String> getFilesInCommit(org.eclipse.jgit.lib.Repository repository, org.eclipse.jgit.revwalk.RevCommit commit)
public boolean createSiteCloneRemoteGitRepo(String siteId, String sandboxBranch, String remoteName, String remoteUrl, String remoteBranch, boolean singleBranch, String authenticationType, String remoteUsername, String remotePassword, String remoteToken, String remotePrivateKey) throws InvalidRemoteRepositoryException, InvalidRemoteRepositoryCredentialsException, RemoteRepositoryNotFoundException, ServiceException
Copyright © 2018 CrafterCMS. All rights reserved.