Package ca.phon.app.project.git
Class ProjectGitController
java.lang.Object
ca.phon.app.project.git.ProjectGitController
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.jgit.dircache.DirCache
addToIndex
(String filepattern) Add files to current index.void
org.eclipse.jgit.revwalk.RevCommit
Commit changes to repository.org.eclipse.jgit.revwalk.RevCommit
commitAllChanges
(String message) Commit all changes to repository.Get the folder for the git repository.boolean
Is the project under git controlorg.eclipse.jgit.api.Git
init()
Setup a new git repository for the project.boolean
isOpen()
org.eclipse.jgit.api.Git
open()
Open existing repository for projectvoid
printStatus
(Writer writer) org.eclipse.jgit.api.PullResult
pull()
Pull from repository.org.eclipse.jgit.api.PullResult
Pull from repositoryorg.eclipse.jgit.api.PullResult
pull
(org.eclipse.jgit.lib.ProgressMonitor monitor) Pull from repository.Iterable<org.eclipse.jgit.transport.PushResult>
Push changesIterable<org.eclipse.jgit.transport.PushResult>
push
(org.eclipse.jgit.lib.ProgressMonitor monitor) void
org.eclipse.jgit.api.Status
org.eclipse.jgit.api.Status
status()
Get status of repository.org.eclipse.jgit.api.Status
-
Constructor Details
-
ProjectGitController
-
-
Method Details
-
closeRepository
public void closeRepository() -
getProject
-
getRepositoryFolder
Get the folder for the git repository.- Returns:
- folder for git repository
-
hasGitFolder
public boolean hasGitFolder()Is the project under git control- Returns:
true
if the .git folder exists, false otherwise
-
init
public org.eclipse.jgit.api.Git init() throws IOException, IllegalStateException, org.eclipse.jgit.api.errors.GitAPIExceptionSetup a new git repository for the project.- Returns:
- the new git instance
- Throws:
org.eclipse.jgit.api.errors.GitAPIException
IllegalStateException
IOException
-
setupDefaultGitIgnore
- Throws:
IOException
-
open
Open existing repository for project- Returns:
- git instance
- Throws:
IOException
-
isOpen
public boolean isOpen() -
status
public org.eclipse.jgit.api.Status status() throws org.eclipse.jgit.errors.NoWorkTreeException, org.eclipse.jgit.api.errors.GitAPIExceptionGet status of repository.- Returns:
- repository status
- Throws:
org.eclipse.jgit.api.errors.GitAPIException
org.eclipse.jgit.errors.NoWorkTreeException
-
status
public org.eclipse.jgit.api.Status status(String path) throws org.eclipse.jgit.errors.NoWorkTreeException, org.eclipse.jgit.api.errors.GitAPIException - Throws:
org.eclipse.jgit.errors.NoWorkTreeException
org.eclipse.jgit.api.errors.GitAPIException
-
statis
public org.eclipse.jgit.api.Status statis(String... paths) throws org.eclipse.jgit.errors.NoWorkTreeException, org.eclipse.jgit.api.errors.GitAPIException - Throws:
org.eclipse.jgit.errors.NoWorkTreeException
org.eclipse.jgit.api.errors.GitAPIException
-
printStatus
public void printStatus(Writer writer) throws IOException, org.eclipse.jgit.api.errors.GitAPIException - Throws:
IOException
org.eclipse.jgit.api.errors.GitAPIException
-
addToIndex
public org.eclipse.jgit.dircache.DirCache addToIndex(String filepattern) throws org.eclipse.jgit.api.errors.NoFilepatternException, org.eclipse.jgit.api.errors.GitAPIException Add files to current index.- Parameters:
filepattern
-- Throws:
org.eclipse.jgit.api.errors.GitAPIException
org.eclipse.jgit.api.errors.NoFilepatternException
-
commit
public org.eclipse.jgit.revwalk.RevCommit commit(String message) throws org.eclipse.jgit.api.errors.NoHeadException, org.eclipse.jgit.api.errors.NoMessageException, org.eclipse.jgit.api.errors.UnmergedPathsException, org.eclipse.jgit.api.errors.ConcurrentRefUpdateException, org.eclipse.jgit.api.errors.WrongRepositoryStateException, org.eclipse.jgit.api.errors.AbortedByHookException, org.eclipse.jgit.api.errors.GitAPIException Commit changes to repository.- Parameters:
message
-- Throws:
org.eclipse.jgit.api.errors.GitAPIException
org.eclipse.jgit.api.errors.AbortedByHookException
org.eclipse.jgit.api.errors.WrongRepositoryStateException
org.eclipse.jgit.api.errors.ConcurrentRefUpdateException
org.eclipse.jgit.api.errors.UnmergedPathsException
org.eclipse.jgit.api.errors.NoMessageException
org.eclipse.jgit.api.errors.NoHeadException
-
commitAllChanges
public org.eclipse.jgit.revwalk.RevCommit commitAllChanges(String message) throws org.eclipse.jgit.api.errors.NoHeadException, org.eclipse.jgit.api.errors.NoMessageException, org.eclipse.jgit.api.errors.UnmergedPathsException, org.eclipse.jgit.api.errors.ConcurrentRefUpdateException, org.eclipse.jgit.api.errors.WrongRepositoryStateException, org.eclipse.jgit.api.errors.AbortedByHookException, org.eclipse.jgit.api.errors.GitAPIException Commit all changes to repository.- Parameters:
message
-- Returns:
- commit revision
- Throws:
org.eclipse.jgit.api.errors.NoHeadException
org.eclipse.jgit.api.errors.NoMessageException
org.eclipse.jgit.api.errors.UnmergedPathsException
org.eclipse.jgit.api.errors.ConcurrentRefUpdateException
org.eclipse.jgit.api.errors.WrongRepositoryStateException
org.eclipse.jgit.api.errors.AbortedByHookException
org.eclipse.jgit.api.errors.GitAPIException
-
pull
public org.eclipse.jgit.api.PullResult pull() throws org.eclipse.jgit.api.errors.WrongRepositoryStateException, org.eclipse.jgit.api.errors.InvalidConfigurationException, org.eclipse.jgit.api.errors.DetachedHeadException, org.eclipse.jgit.api.errors.InvalidRemoteException, org.eclipse.jgit.api.errors.CanceledException, org.eclipse.jgit.api.errors.RefNotFoundException, org.eclipse.jgit.api.errors.RefNotAdvertisedException, org.eclipse.jgit.api.errors.NoHeadException, org.eclipse.jgit.api.errors.TransportException, org.eclipse.jgit.api.errors.GitAPIExceptionPull from repository. This is the same as calling 'git pull' without args.- Returns:
- pull result
- Throws:
org.eclipse.jgit.api.errors.GitAPIException
org.eclipse.jgit.api.errors.TransportException
org.eclipse.jgit.api.errors.NoHeadException
org.eclipse.jgit.api.errors.RefNotAdvertisedException
org.eclipse.jgit.api.errors.RefNotFoundException
org.eclipse.jgit.api.errors.CanceledException
org.eclipse.jgit.api.errors.InvalidRemoteException
org.eclipse.jgit.api.errors.DetachedHeadException
org.eclipse.jgit.api.errors.InvalidConfigurationException
org.eclipse.jgit.api.errors.WrongRepositoryStateException
-
pull
public org.eclipse.jgit.api.PullResult pull(org.eclipse.jgit.lib.ProgressMonitor monitor) throws org.eclipse.jgit.api.errors.WrongRepositoryStateException, org.eclipse.jgit.api.errors.InvalidConfigurationException, org.eclipse.jgit.api.errors.DetachedHeadException, org.eclipse.jgit.api.errors.InvalidRemoteException, org.eclipse.jgit.api.errors.CanceledException, org.eclipse.jgit.api.errors.RefNotFoundException, org.eclipse.jgit.api.errors.RefNotAdvertisedException, org.eclipse.jgit.api.errors.NoHeadException, org.eclipse.jgit.api.errors.TransportException, org.eclipse.jgit.api.errors.GitAPIException Pull from repository. This is the same as calling 'git pull' without args.- Parameters:
monitor
-- Returns:
- pull result
- Throws:
org.eclipse.jgit.api.errors.GitAPIException
org.eclipse.jgit.api.errors.TransportException
org.eclipse.jgit.api.errors.NoHeadException
org.eclipse.jgit.api.errors.RefNotAdvertisedException
org.eclipse.jgit.api.errors.RefNotFoundException
org.eclipse.jgit.api.errors.CanceledException
org.eclipse.jgit.api.errors.InvalidRemoteException
org.eclipse.jgit.api.errors.DetachedHeadException
org.eclipse.jgit.api.errors.InvalidConfigurationException
org.eclipse.jgit.api.errors.WrongRepositoryStateException
-
pull
public org.eclipse.jgit.api.PullResult pull(String remote, String branch, org.eclipse.jgit.lib.ProgressMonitor monitor) throws org.eclipse.jgit.api.errors.WrongRepositoryStateException, org.eclipse.jgit.api.errors.InvalidConfigurationException, org.eclipse.jgit.api.errors.DetachedHeadException, org.eclipse.jgit.api.errors.InvalidRemoteException, org.eclipse.jgit.api.errors.CanceledException, org.eclipse.jgit.api.errors.RefNotFoundException, org.eclipse.jgit.api.errors.RefNotAdvertisedException, org.eclipse.jgit.api.errors.NoHeadException, org.eclipse.jgit.api.errors.TransportException, org.eclipse.jgit.api.errors.GitAPIException Pull from repository- Parameters:
remote
-branch
-monitor
-- Throws:
org.eclipse.jgit.api.errors.GitAPIException
org.eclipse.jgit.api.errors.TransportException
org.eclipse.jgit.api.errors.NoHeadException
org.eclipse.jgit.api.errors.RefNotAdvertisedException
org.eclipse.jgit.api.errors.RefNotFoundException
org.eclipse.jgit.api.errors.CanceledException
org.eclipse.jgit.api.errors.InvalidRemoteException
org.eclipse.jgit.api.errors.DetachedHeadException
org.eclipse.jgit.api.errors.InvalidConfigurationException
org.eclipse.jgit.api.errors.WrongRepositoryStateException
-
push
public Iterable<org.eclipse.jgit.transport.PushResult> push(String remote, org.eclipse.jgit.lib.ProgressMonitor monitor) throws org.eclipse.jgit.api.errors.InvalidRemoteException, org.eclipse.jgit.api.errors.TransportException, org.eclipse.jgit.api.errors.GitAPIException Push changes- Parameters:
remote
-mointor
-- Throws:
org.eclipse.jgit.api.errors.GitAPIException
org.eclipse.jgit.api.errors.TransportException
org.eclipse.jgit.api.errors.InvalidRemoteException
-
push
public Iterable<org.eclipse.jgit.transport.PushResult> push(org.eclipse.jgit.lib.ProgressMonitor monitor) throws org.eclipse.jgit.api.errors.InvalidRemoteException, org.eclipse.jgit.api.errors.TransportException, org.eclipse.jgit.api.errors.GitAPIException - Throws:
org.eclipse.jgit.api.errors.InvalidRemoteException
org.eclipse.jgit.api.errors.TransportException
org.eclipse.jgit.api.errors.GitAPIException
-