@@ -462,8 +462,8 @@ Public Sub initAndPush
462
462
fx.Msgbox(Main.MainForm,"Please configure your git account info first." ,"" )
463
463
Return
464
464
End If
465
- wait for (projectGit.push (username,password,"origin" ,"master" )) complete (result As String )
466
- If result.StartsWith( "error" ) Then
465
+ wait for (projectGit.pushAsync (username,password,"origin" ,"master" )) complete (result As Boolean )
466
+ If result= False Then
467
467
fx.Msgbox(Main.MainForm,"Push Failed" ,"" )
468
468
End If
469
469
End Sub
@@ -497,7 +497,7 @@ Public Sub commitAndPush(commitMessage As String)
497
497
498
498
Main.enableAutosaveTimer(False )
499
499
Main.updateOperation("commiting and pushing" )
500
-
500
+ Sleep( 0 )
501
501
502
502
If projectGit.isConflicting Then
503
503
Log("conflicting" )
@@ -508,14 +508,14 @@ Public Sub commitAndPush(commitMessage As String)
508
508
Else
509
509
projectGit.add("." )
510
510
projectGit.rebase("CONTINUE" ,"" )
511
- wait for (projectGit.push (username,password,"origin" ,"master" )) complete (result As String )
512
- If result.StartsWith( "error" ) Then
511
+ wait for (projectGit.pushAsync (username,password,"origin" ,"master" )) complete (pushResult As Boolean )
512
+ If pushResult= False Then
513
513
fx.Msgbox(Main.MainForm,"Failed" ,"" )
514
514
Return
515
515
End If
516
516
End If
517
517
Else
518
- updateLocalFileBasedonFetch(username,password,email)
518
+ wait for ( updateLocalFileBasedonFetch(username,password,email)) Complete (success as Object )
519
519
Dim diffList As List
520
520
diffList=projectGit.diffList
521
521
Log(diffList)
@@ -524,20 +524,19 @@ Public Sub commitAndPush(commitMessage As String)
524
524
projectGit.commit(commitMessage,username,email)
525
525
End If
526
526
527
-
528
- If samelocalHeadAndRemoteHead(username,password,False )=False Then
529
- wait for (projectGit.pullRebase(username,password)) complete (result As String )
530
-
527
+ wait for (samelocalHeadAndRemoteHead(username,password,False )) Complete (isSame As Boolean )
528
+ If isSame = False Then
529
+
531
530
Dim rebaseResult As String
532
- rebaseResult=result
531
+ rebaseResult=projectGit.pullRebase(username,password)
533
532
Log("rebaseResult" &rebaseResult)
534
533
If rebaseResult="STOPPED" Or rebaseResult="CONFLICTS" Then
535
534
fx.Msgbox(Main.MainForm,"Conflits exist. Please solve the conflicts first." ,"" )
536
535
closeFile
537
536
Return
538
537
Else
539
- wait for (projectGit.push (username,password,"origin" ,"master" )) complete (result As String )
540
- If result.StartsWith( "error" ) Then
538
+ wait for (projectGit.pushAsync (username,password,"origin" ,"master" )) complete (pushResult As Boolean )
539
+ If pushResult= False Then
541
540
fx.Msgbox(Main.MainForm,"Push Failed" ,"" )
542
541
Return
543
542
End If
@@ -549,15 +548,15 @@ Public Sub commitAndPush(commitMessage As String)
549
548
Main.updateOperation("committed" )
550
549
End Sub
551
550
552
- Sub samelocalHeadAndRemoteHead (username As String ,password As String ,fetch As Boolean ) As Boolean
551
+ Sub samelocalHeadAndRemoteHead (username As String ,password As String ,fetch As Boolean ) As ResumableSub
553
552
Dim result As Boolean =True
554
553
Dim refsPath As String
555
554
refsPath=File.Combine(File.Combine(path,".git" ),"refs" )
556
555
If File.Exists(refsPath,"remotes" ) Then
557
556
Dim previousRemoteHead As String
558
557
previousRemoteHead=projectGit.getCommitIDofBranch("refs/remotes/origin/master" )
559
558
If fetch Then
560
- projectGit.fetch (username,password)
559
+ wait for ( projectGit.fetchAsync (username,password)) Complete (success As Object )
561
560
End If
562
561
Dim localHead,remoteHead As String
563
562
localHead=projectGit.getCommitIDofBranch("refs/heads/master" )
@@ -576,8 +575,9 @@ Sub samelocalHeadAndRemoteHead(username As String,password As String,fetch As Bo
576
575
Return result
577
576
End Sub
578
577
579
- Sub updateLocalFileBasedonFetch (username As String ,password As String ,email As String )
580
- If samelocalHeadAndRemoteHead(username,password,True )=False Then
578
+ Sub updateLocalFileBasedonFetch (username As String ,password As String ,email As String ) as ResumableSub
579
+ wait for (samelocalHeadAndRemoteHead(username,password,True )) Complete (isSame As Boolean )
580
+ If isSame = False Then
581
581
Dim localHead,remoteHead As String
582
582
localHead=projectGit.getCommitIDofBranch("refs/heads/master" )
583
583
remoteHead=projectGit.getCommitIDofBranch("refs/remotes/origin/master" )
@@ -629,7 +629,7 @@ Sub updateLocalFileBasedonFetch(username As String,password As String,email As S
629
629
projectGit.add("." )
630
630
projectGit.commit("sync" ,username,email)
631
631
End If
632
- wait for (projectGit.push (username,password,"origin" ,"master" )) complete (result As String )
632
+ wait for (projectGit.pushAsync (username,password,"origin" ,"master" )) complete (result As Boolean )
633
633
Log("pushresult" &result)
634
634
End If
635
635
projectGit.unsetWorkdir
0 commit comments