public class GitFileRepository extends java.lang.Object implements GitRepository, java.lang.AutoCloseable
| Constructor and Description |
|---|
GitFileRepository(java.io.File parentDirectory) |
GitFileRepository(java.lang.String repositoryName,
java.io.File parentDirectory) |
| Modifier and Type | Method and Description |
|---|---|
org.eclipse.jgit.revwalk.RevCommit |
addSubmodule(GitFileRepository submoduleRepo) |
org.eclipse.jgit.lib.Ref |
checkout(java.lang.String branchName) |
void |
close()
Clean up any held resources
(called automatically when used as a @Rule)
|
org.eclipse.jgit.revwalk.RevCommit |
commit(java.lang.String message)
Commits all changes in the working tree.
|
org.eclipse.jgit.revwalk.RevCommit |
commit(java.lang.String message,
java.lang.String... paths)
Commits changes to the given paths.
|
org.eclipse.jgit.lib.Ref |
createAnnotatedTag(java.lang.String tagName,
java.lang.String message) |
org.eclipse.jgit.lib.Ref |
createBranch(java.lang.String branchName) |
org.eclipse.jgit.lib.Ref |
createLightWeightTag(java.lang.String tagName) |
java.io.File |
file(java.lang.Object... path) |
org.eclipse.jgit.api.Git |
getGit()
Returns the underlying Git object from JGit.
|
org.eclipse.jgit.lib.Ref |
getHead() |
java.lang.String |
getId() |
java.lang.String |
getName() |
java.util.List<java.net.URI> |
getRemotes() |
java.net.URI |
getUrl() |
java.io.File |
getWorkTree() |
static GitFileRepository |
init(java.io.File repositoryDirectory)
Factory method for creating a GitRepository without using a JUnit @Rule.
|
static GitFileRepository |
open(java.io.File repositoryDirectory)
Factory method for opening a GitRepository without using a JUnit @Rule.
|
org.eclipse.jgit.revwalk.RevCommit |
updateSubmodulesToLatest()
Updates any submodules in this repository to the latest in the submodule origin repository
|
public GitFileRepository(java.lang.String repositoryName,
java.io.File parentDirectory)
public GitFileRepository(java.io.File parentDirectory)
public org.eclipse.jgit.api.Git getGit()
public java.lang.String getName()
public static GitFileRepository init(java.io.File repositoryDirectory) throws org.eclipse.jgit.api.errors.GitAPIException
org.eclipse.jgit.api.errors.GitAPIExceptionpublic static GitFileRepository open(java.io.File repositoryDirectory) throws java.io.IOException
java.io.IOExceptionpublic void close()
close in interface java.lang.AutoCloseablepublic org.eclipse.jgit.revwalk.RevCommit addSubmodule(GitFileRepository submoduleRepo) throws org.eclipse.jgit.api.errors.GitAPIException
org.eclipse.jgit.api.errors.GitAPIExceptionpublic java.util.List<java.net.URI> getRemotes()
throws org.eclipse.jgit.api.errors.GitAPIException,
java.net.URISyntaxException
org.eclipse.jgit.api.errors.GitAPIExceptionjava.net.URISyntaxExceptionpublic org.eclipse.jgit.revwalk.RevCommit updateSubmodulesToLatest()
throws org.eclipse.jgit.api.errors.GitAPIException
org.eclipse.jgit.api.errors.GitAPIExceptionpublic org.eclipse.jgit.revwalk.RevCommit commit(java.lang.String message,
java.lang.String... paths)
throws org.eclipse.jgit.api.errors.GitAPIException
org.eclipse.jgit.api.errors.GitAPIExceptionpublic org.eclipse.jgit.revwalk.RevCommit commit(java.lang.String message)
throws org.eclipse.jgit.api.errors.GitAPIException
git commit -am "message"commit in interface GitRepositoryorg.eclipse.jgit.api.errors.GitAPIExceptionpublic org.eclipse.jgit.lib.Ref createBranch(java.lang.String branchName)
throws org.eclipse.jgit.api.errors.GitAPIException
createBranch in interface GitRepositoryorg.eclipse.jgit.api.errors.GitAPIExceptionpublic org.eclipse.jgit.lib.Ref checkout(java.lang.String branchName)
throws org.eclipse.jgit.api.errors.GitAPIException
checkout in interface GitRepositoryorg.eclipse.jgit.api.errors.GitAPIExceptionpublic org.eclipse.jgit.lib.Ref createLightWeightTag(java.lang.String tagName)
throws org.eclipse.jgit.api.errors.GitAPIException
createLightWeightTag in interface GitRepositoryorg.eclipse.jgit.api.errors.GitAPIExceptionpublic org.eclipse.jgit.lib.Ref createAnnotatedTag(java.lang.String tagName,
java.lang.String message)
throws org.eclipse.jgit.api.errors.GitAPIException
org.eclipse.jgit.api.errors.GitAPIExceptionpublic org.eclipse.jgit.lib.Ref getHead()
throws java.io.IOException
java.io.IOExceptionpublic java.io.File getWorkTree()
getWorkTree in interface GitRepositorypublic java.io.File file(java.lang.Object... path)
file in interface GitRepositorypublic java.net.URI getUrl()
getUrl in interface GitRepositorypublic java.lang.String getId()