Sub Class_Globals
Private fx As JFX
Private gitJO As JavaObject
Private gitJOStatic As JavaObject
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(path As String)
gitJOStatic.InitializeStatic("org.eclipse.jgit.api.Git")
If File.Exists(path,".git")=False Then
Log("init")
init(path)
End If
gitJO=gitJOStatic.RunMethodJO("open",Array(getFile(path)))
End Sub
Sub getFile(path As String) As JavaObject
Dim fileJO As JavaObject
fileJO.InitializeNewInstance("java.io.File",Array(path))
Return fileJO
End Sub
Public Sub init(path As String)
gitJOStatic.RunMethodJO("init",Null).RunMethodJO("setDirectory",Array(getFile(path))).RunMethodJO("call",Null)
End Sub
Public Sub push(username As String,password As String,remoteName As String,branchName As String) As ResumableSub
Sleep(0)
Try
Dim PushCommand As JavaObject
PushCommand=gitJO.RunMethodJO("push",Null)
PushCommand.RunMethodJO("setRemote",Array(remoteName))
PushCommand.RunMethodJO("add",Array(branchName))
If username<>"" Then
Dim cp As JavaObject
cp=setCredentialProvider(username,password)
PushCommand.RunMethod("setCredentialsProvider",Array(cp))
End If
PushCommand.RunMethodJo("call",Null)
Catch
Log(LastException)
Return "error"&LastException.Message
End Try
Return "success"
End Sub