Package org.omegat.core.team2.impl
Class GITRemoteRepository2
java.lang.Object
org.omegat.core.team2.impl.GITRemoteRepository2
- All Implemented Interfaces:
IRemoteRepository2
GIT repository connection implementation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.omegat.core.team2.IRemoteRepository2
IRemoteRepository2.BadRepositoryException, IRemoteRepository2.NetworkException -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddForCommit(String path) Add directory/file to commit.voidaddForDeletion(String path) Add path to be deleted.Commit files in the current stack.static booleandeleteDirectory(File path) Delete target directory.static StringgetDefaultBranchName(org.eclipse.jgit.lib.Repository repository) Retrieve default branch name from repository.getFileVersion(String file) Get version string.Getter for local directory.String[]Get recently deleted files.voidinit(RepositoryDefinition repo, File dir, ProjectTeamSettings teamSettings) Initialize remote repository access credentials.static booleanisGitRepository(String url) Determines whether the supplied URL represents a valid Git repository.static voidPlugin loader.voidswitchToVersion(String version) Switch to git version specified.static voidPlugin unloader.
-
Constructor Details
-
GITRemoteRepository2
public GITRemoteRepository2()
-
-
Method Details
-
loadPlugins
public static void loadPlugins()Plugin loader. -
unloadPlugins
public static void unloadPlugins()Plugin unloader. -
init
public void init(RepositoryDefinition repo, File dir, ProjectTeamSettings teamSettings) throws Exception Initialize remote repository access credentials.- Specified by:
initin interfaceIRemoteRepository2- Parameters:
repo- repository description instancedir- directory for store filesteamSettings- team settings.- Throws:
Exception- when error happened.
-
getFileVersion
Get version string.- Specified by:
getFileVersionin interfaceIRemoteRepository2- Parameters:
file- target file to check.- Returns:
- version string when file exists, otherwise null.
- Throws:
IOException- when error occurred.
-
switchToVersion
Switch to git version specified.- Specified by:
switchToVersionin interfaceIRemoteRepository2- Parameters:
version- version string to switch.- Throws:
Exception- when error occurred.
-
addForCommit
Add directory/file to commit.- Specified by:
addForCommitin interfaceIRemoteRepository2- Parameters:
path- The relative path of the item from the root of the repo (should not start with a/)- Throws:
Exception- when error occurred.
-
addForDeletion
Add path to be deleted.- Specified by:
addForDeletionin interfaceIRemoteRepository2- Parameters:
path- The relative path of the item from the root of the repo (should not start with a/)- Throws:
Exception- when error occurred.
-
getLocalDirectory
Getter for local directory.- Specified by:
getLocalDirectoryin interfaceIRemoteRepository2- Returns:
- local directory file object.
-
getRecentlyDeletedFiles
Get recently deleted files.- Specified by:
getRecentlyDeletedFilesin interfaceIRemoteRepository2- Returns:
- Array of paths of deleted files.
- Throws:
Exception- when error occurred.
-
commit
Commit files in the current stack.- Specified by:
commitin interfaceIRemoteRepository2- Parameters:
onVersions- if a version defined, then commit must be just after this version. Otherwise, (if a remote repository was updated after rebase), commit shouldn't be processed and should return null. If a version is null, then commit can be after any version, i.e. a previous version shouldn't be checked. It can be several versions defined since the glossary will be committed after project_save.tmx.comment- comment for commit- Returns:
- resulted commit name.
- Throws:
Exception- when error occurred.
-
deleteDirectory
Delete target directory.- Parameters:
path- to be deleted.- Returns:
- true when succeeded, otherwise false.
-
getDefaultBranchName
Retrieve default branch name from repository.- Parameters:
repository- target repository.- Returns:
- default branch name, ordinary "main" (recent popular) or "master" (old default)
-
isGitRepository
Determines whether the supplied URL represents a valid Git repository.Does the equivalent of
git ls-remote url.- Parameters:
url- URL of supposed remote repository- Returns:
- true if the repository appears to be valid, false otherwise
-