public class GitFacade extends GitFacadeSupport
| Constructor and Description |
|---|
GitFacade() |
| Modifier and Type | Method and Description |
|---|---|
List<String> |
branches()
Returns all the branch names we can use in the local repo
|
protected void |
checkoutBranch(org.eclipse.jgit.api.Git git,
String branch) |
List<String> |
completePath(String branch,
String completionText,
boolean directoriesOnly)
Provides a file/path completion hook so we can start typing the name of a file or directory
|
protected void |
configureBranch(String branch) |
void |
createBranch(String fromBranch,
String newBranch)
Creates a new branch from the given branch
|
CommitInfo |
createDirectory(String branch,
String path,
String commitMessage,
String authorName,
String authorEmail)
Creates a new file if it doesn't already exist
|
String |
currentBranch() |
void |
destroy() |
String |
diff(String objectId,
String baseObjectId,
String path)
Performs a diff of the latest or a specifc version of the given blobPath
against either the previous or a given baseObjectId
|
protected void |
doPull() |
protected Iterable<org.eclipse.jgit.transport.PushResult> |
doPush(org.eclipse.jgit.api.Git git) |
FileInfo |
exists(String branch,
String pathOrEmpty)
Checks if the file exists at the given path and returns the file metadata or null if it does not exist
|
static Date |
getCommitDate(org.eclipse.jgit.revwalk.RevCommit commit)
Retrieves a Java Date from a Git commit.
|
CommitInfo |
getCommitInfo(String commitId)
Returns details about the commit, such as its message etc
|
List<CommitTreeInfo> |
getCommitTree(String commitId)
Returns the commit tree for the given commit id
|
String |
getConfigDirName() |
String |
getContent(String objectId,
String blobPath)
Get the contents of a blobPath for a given commit objectId
|
org.eclipse.jgit.transport.CredentialsProvider |
getCredentials() |
String |
getDefaultBranch()
Defaults to the current branch on disk if not explicitly configured
|
String |
getDefaultRemoteRepository() |
String |
getHEAD() |
long |
getPullTimePeriod() |
String |
getRemote() |
String |
getRemoteRepository() |
File |
getRootGitDirectory() |
org.eclipse.jgit.lib.PersonIdent |
getStashPersonIdent() |
Timer |
getTimer() |
protected <T> T |
gitOperation(org.eclipse.jgit.lib.PersonIdent personIdent,
Callable<T> callable)
Performs the given operations on a clean git repository
|
List<CommitInfo> |
history(String branch,
String objectId,
String path,
int limit)
Return the history of the repository or a specific directory or file path
|
void |
init() |
void |
initialiseGitRepo() |
boolean |
isCloneAllBranches() |
boolean |
isCloneRemoteRepoOnStartup() |
boolean |
isPullBeforeOperation() |
boolean |
isPullOnStartup() |
boolean |
isPushOnCommit() |
protected boolean |
localBranchExists(String branch) |
protected void |
logPull(String message) |
FileContents |
read(String branch,
String pathOrEmpty)
Reads the file contents of the given path
|
String |
readJsonChildContent(String branch,
String path,
String fileNameWildcardOrBlank,
String search)
Reads the child JSON file contents which match the given search string (if specified) and which match the given file name wildcard (using * to match any characters in the name).
|
void |
remove(String branch,
String path,
String commitMessage,
String authorName,
String authorEmail) |
void |
rename(String branch,
String oldPath,
String newPath,
String commitMessage,
String authorName,
String authorEmail)
Renames the given oldPath to the newPath location for the given branch, commit message and user
|
void |
revertTo(String branch,
String objectId,
String blobPath,
String commitMessage,
String authorName,
String authorEmail)
Reverts the file to a previous value
|
void |
setCloneAllBranches(boolean cloneAllBranches) |
void |
setCloneRemoteRepoOnStartup(boolean cloneRemoteRepoOnStartup) |
void |
setConfigDirectory(File configDirectory) |
void |
setConfigDirName(String configDirName) |
void |
setCredentials(org.eclipse.jgit.transport.CredentialsProvider credentials) |
void |
setDefaultBranch(String defaultBranch) |
void |
setDefaultRemoteRepository(String defaultRemoteRepository) |
void |
setPullBeforeOperation(boolean pullBeforeOperation) |
void |
setPullOnStartup(boolean pullOnStartup) |
void |
setPullTimePeriod(long pullTimePeriod) |
void |
setPushOnCommit(boolean pushOnCommit) |
void |
setRemote(String remote) |
void |
setRemoteRepository(String remoteRepository) |
void |
setStashPersonIdent(org.eclipse.jgit.lib.PersonIdent stashPersonIdent) |
void |
setTimer(Timer timer) |
org.eclipse.jgit.api.Status |
status() |
static String |
trimLeadingSlash(String path) |
CommitInfo |
write(String branch,
String path,
String commitMessage,
String authorName,
String authorEmail,
String contents) |
commitThenPush, createCommitInfo, defaultObjectId, doCompletePath, doCreateBranch, doCreateDirectory, doDiff, doExists, doGetCommitInfo, doGetCommitTree, doGetContent, doGetHead, doHistory, doListBranches, doRead, doReadJsonChildContent, doRemove, doRename, doRevert, doWrite, getBranchObjectId, getDefaultObjectName, getFile, getFilePattern, getShortCommitHash, isIgnoreFile, removeLeadingSlash, toStringpublic void init()
throws Exception
init in class io.hawt.util.MBeanSupportExceptionpublic void destroy()
throws Exception
destroy in class io.hawt.util.MBeanSupportExceptionpublic org.eclipse.jgit.lib.PersonIdent getStashPersonIdent()
public void setStashPersonIdent(org.eclipse.jgit.lib.PersonIdent stashPersonIdent)
public String getRemoteRepository()
public void setRemoteRepository(String remoteRepository)
public String getRemote()
public void setRemote(String remote)
public String getConfigDirName()
public void setConfigDirName(String configDirName)
public String getDefaultRemoteRepository()
public void setDefaultRemoteRepository(String defaultRemoteRepository)
public boolean isPullOnStartup()
public void setPullOnStartup(boolean pullOnStartup)
public boolean isCloneAllBranches()
public void setCloneAllBranches(boolean cloneAllBranches)
public boolean isPushOnCommit()
isPushOnCommit in class GitFacadeSupportpublic void setPushOnCommit(boolean pushOnCommit)
public boolean isPullBeforeOperation()
public void setPullBeforeOperation(boolean pullBeforeOperation)
public boolean isCloneRemoteRepoOnStartup()
public void setCloneRemoteRepoOnStartup(boolean cloneRemoteRepoOnStartup)
public org.eclipse.jgit.transport.CredentialsProvider getCredentials()
public void setCredentials(org.eclipse.jgit.transport.CredentialsProvider credentials)
public long getPullTimePeriod()
public void setPullTimePeriod(long pullTimePeriod)
public Timer getTimer()
public void setTimer(Timer timer)
public String getDefaultBranch()
public void setDefaultBranch(String defaultBranch)
public String getContent(String objectId, String blobPath)
GitFacadeMXBeanpublic FileContents read(String branch, String pathOrEmpty) throws IOException, org.eclipse.jgit.api.errors.GitAPIException
IOExceptionorg.eclipse.jgit.api.errors.GitAPIExceptionpublic FileInfo exists(String branch, String pathOrEmpty) throws IOException, org.eclipse.jgit.api.errors.GitAPIException
IOExceptionorg.eclipse.jgit.api.errors.GitAPIExceptionpublic List<String> completePath(String branch, String completionText, boolean directoriesOnly)
public String readJsonChildContent(String branch, String path, String fileNameWildcardOrBlank, String search) throws IOException
IOExceptionpublic CommitInfo write(String branch, String path, String commitMessage, String authorName, String authorEmail, String contents)
public CommitInfo createDirectory(String branch, String path, String commitMessage, String authorName, String authorEmail)
public void createBranch(String fromBranch, String newBranch)
GitFacadeMXBeanpublic List<CommitTreeInfo> getCommitTree(String commitId)
GitFacadeMXBeanpublic CommitInfo getCommitInfo(String commitId)
GitFacadeMXBeanpublic void revertTo(String branch, String objectId, String blobPath, String commitMessage, String authorName, String authorEmail)
GitFacadeMXBeanpublic void rename(String branch, String oldPath, String newPath, String commitMessage, String authorName, String authorEmail)
GitFacadeMXBeanpublic void remove(String branch, String path, String commitMessage, String authorName, String authorEmail)
public List<String> branches()
GitFacadeMXBeanprotected Iterable<org.eclipse.jgit.transport.PushResult> doPush(org.eclipse.jgit.api.Git git) throws Exception
doPush in class GitFacadeSupportExceptionpublic String getHEAD()
public List<CommitInfo> history(String branch, String objectId, String path, int limit)
GitFacadeMXBeanpublic static Date getCommitDate(org.eclipse.jgit.revwalk.RevCommit commit)
commit - the commitpublic String diff(String objectId, String baseObjectId, String path)
GitFacadeMXBeanpublic File getRootGitDirectory()
public void setConfigDirectory(File configDirectory)
public void initialiseGitRepo()
throws IOException,
org.eclipse.jgit.api.errors.GitAPIException
IOExceptionorg.eclipse.jgit.api.errors.GitAPIExceptionprotected void doPull()
protected void logPull(String message)
public org.eclipse.jgit.api.Status status()
protected <T> T gitOperation(org.eclipse.jgit.lib.PersonIdent personIdent,
Callable<T> callable)
public String currentBranch()
protected void checkoutBranch(org.eclipse.jgit.api.Git git,
String branch)
throws org.eclipse.jgit.api.errors.GitAPIException
checkoutBranch in class GitFacadeSupportorg.eclipse.jgit.api.errors.GitAPIExceptionprotected void configureBranch(String branch)
protected boolean localBranchExists(String branch) throws org.eclipse.jgit.api.errors.GitAPIException
org.eclipse.jgit.api.errors.GitAPIExceptionCopyright © 2014. All Rights Reserved.