Add Remote and Push
This commit is contained in:
65
main.pb
65
main.pb
@@ -1113,6 +1113,49 @@ EndProcedure
|
|||||||
|
|
||||||
;-Suite
|
;-Suite
|
||||||
|
|
||||||
|
Procedure AddRemoteRepo(Url.s,name.s="origin")
|
||||||
|
;Check if this remote already exists
|
||||||
|
main\Gitcall\args = "remote get-url "+name
|
||||||
|
If RunExe(@main\Gitcall) = 0
|
||||||
|
;if yes we remove it
|
||||||
|
main\Gitcall\args = "remote remove "+name
|
||||||
|
RunExe(@main\Gitcall)
|
||||||
|
EndIf
|
||||||
|
; We add a new remote
|
||||||
|
main\Gitcall\args = "remote add "+name+" "+Url
|
||||||
|
If RunExe(@main\Gitcall) = 0
|
||||||
|
MessageRequester("Git Remote", "OK:" + #LF$ + main\Gitcall\output, #PB_MessageRequester_Info)
|
||||||
|
ProcedureReturn #True
|
||||||
|
Else
|
||||||
|
MessageRequester("Git config", "Échec: " + #LF$ + main\Gitcall\errors, #PB_MessageRequester_Error)
|
||||||
|
ProcedureReturn #False
|
||||||
|
EndIf
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
Procedure GetRemoteUrl(name.s="origin")
|
||||||
|
main\Gitcall\args = "remote get-url "+name
|
||||||
|
If RunExe(@main\Gitcall) = 0
|
||||||
|
SetGadgetText(#GdtFieldRemote,main\GitCall\output)
|
||||||
|
Else
|
||||||
|
SetGadgetText(#GdtFieldRemote,"")
|
||||||
|
EndIf
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
Procedure DoPush()
|
||||||
|
If Trim(GetGadgetText(#GdtFieldRemote))=""
|
||||||
|
MessageRequester("Git Push", "Échec: " + #LF$ + "You Must tu have a remote", #PB_MessageRequester_Error)
|
||||||
|
EndIf
|
||||||
|
AddRemoteRepo(Trim(GetGadgetText(#GdtFieldRemote)))
|
||||||
|
main\Gitcall\args = "push -u origin "+GetGadgetText(#GdtSlctBranch)
|
||||||
|
If RunExe(@main\Gitcall) = 0
|
||||||
|
MessageRequester("Git Push", "OK:" + #LF$ + main\Gitcall\output, #PB_MessageRequester_Info)
|
||||||
|
ProcedureReturn #True
|
||||||
|
Else
|
||||||
|
MessageRequester("Git Push", "Échec: " + #LF$ + main\Gitcall\errors, #PB_MessageRequester_Error)
|
||||||
|
ProcedureReturn #False
|
||||||
|
EndIf
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
Procedure DoStatus()
|
Procedure DoStatus()
|
||||||
Protected *status.GitStatus=@main\GitStatus
|
Protected *status.GitStatus=@main\GitStatus
|
||||||
|
|
||||||
@@ -1189,8 +1232,10 @@ Procedure DoInit()
|
|||||||
main\Gitcall\args="init --initial-branch="+main\Currentbranch
|
main\Gitcall\args="init --initial-branch="+main\Currentbranch
|
||||||
If RunExe(@main\Gitcall)=0
|
If RunExe(@main\Gitcall)=0
|
||||||
MessageRequester("Git config", "OK:" + #LF$ + main\Gitcall\output, #PB_MessageRequester_Info)
|
MessageRequester("Git config", "OK:" + #LF$ + main\Gitcall\output, #PB_MessageRequester_Info)
|
||||||
|
ProcedureReturn #True
|
||||||
Else
|
Else
|
||||||
MessageRequester("Git config", "Échec: " + #LF$ + main\Gitcall\errors, #PB_MessageRequester_Error)
|
MessageRequester("Git config", "Échec: " + #LF$ + main\Gitcall\errors, #PB_MessageRequester_Error)
|
||||||
|
ProcedureReturn #False
|
||||||
EndIf
|
EndIf
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
@@ -1489,7 +1534,7 @@ Procedure RefreshFileList(null.i)
|
|||||||
ClearGadgetItems(#GdtListStatus)
|
ClearGadgetItems(#GdtListStatus)
|
||||||
ClearList(main\listFilesGit())
|
ClearList(main\listFilesGit())
|
||||||
;-Init File List
|
;-Init File List
|
||||||
;DoLsFilesByType("C")
|
DoLsFilesByType("C")
|
||||||
;DoLsFilesByType("D")
|
;DoLsFilesByType("D")
|
||||||
;DoLsFilesByType("O")
|
;DoLsFilesByType("O")
|
||||||
;DoLsFilesByType("I")
|
;DoLsFilesByType("I")
|
||||||
@@ -1673,7 +1718,11 @@ Procedure OpenGUI()
|
|||||||
|
|
||||||
SetGadgetText(#GgtFieldRepo,main\GitCall\workdir)
|
SetGadgetText(#GgtFieldRepo,main\GitCall\workdir)
|
||||||
CreateThread(@RefreshFileList(),0)
|
CreateThread(@RefreshFileList(),0)
|
||||||
Debug"____"
|
If main\info\isInit=#True
|
||||||
|
GetRemoteUrl("origin")
|
||||||
|
GetCommitHistory()
|
||||||
|
EndIf
|
||||||
|
|
||||||
GetBranchesList()
|
GetBranchesList()
|
||||||
GetCommitHistory()
|
GetCommitHistory()
|
||||||
; =================== EVENT LOOP / BOUCLE ÉVÉNEMENTS ===================
|
; =================== EVENT LOOP / BOUCLE ÉVÉNEMENTS ===================
|
||||||
@@ -1709,6 +1758,12 @@ Procedure OpenGUI()
|
|||||||
If path<>"" And FileSize(path)=-2
|
If path<>"" And FileSize(path)=-2
|
||||||
main\GitCall\workdir=path
|
main\GitCall\workdir=path
|
||||||
EndIf
|
EndIf
|
||||||
|
Case #GdtFieldRemote
|
||||||
|
;If EventType()=#PB_EventType_LostFocus
|
||||||
|
; AddRemoteRepo(GetGadgetText(#GdtFieldRemote),"origin")
|
||||||
|
; EndIf
|
||||||
|
Case #GdtBtnPush
|
||||||
|
DoPush()
|
||||||
Case #GdtListStatus
|
Case #GdtListStatus
|
||||||
Case #GdtBtnIgnore
|
Case #GdtBtnIgnore
|
||||||
ToggleGitIgnoreForSelection()
|
ToggleGitIgnoreForSelection()
|
||||||
@@ -1747,9 +1802,9 @@ OpenGUI()
|
|||||||
|
|
||||||
|
|
||||||
; IDE Options = PureBasic 6.21 (Windows - x64)
|
; IDE Options = PureBasic 6.21 (Windows - x64)
|
||||||
; CursorPosition = 1698
|
; CursorPosition = 1765
|
||||||
; FirstLine = 1656
|
; FirstLine = 1728
|
||||||
; Folding = ------
|
; Folding = -------
|
||||||
; Optimizer
|
; Optimizer
|
||||||
; EnableThread
|
; EnableThread
|
||||||
; EnableXP
|
; EnableXP
|
||||||
|
Reference in New Issue
Block a user