Add First Push
This commit is contained in:
53
main2.pb
53
main2.pb
@@ -945,6 +945,53 @@ Procedure.i DoCommit()
|
||||
ProcedureReturn #True
|
||||
EndProcedure
|
||||
|
||||
Procedure AddRemoteRepo(Url.s,name.s="origin")
|
||||
Url=SupTrim(Url)
|
||||
name=SupTrim(name)
|
||||
Protected add.b=#False
|
||||
;Check if this remote already exists
|
||||
If git("remote get-url "+name) = 0
|
||||
;if yes we remove it
|
||||
If Url<>SupTrim(main\Gitcall\output)
|
||||
git("remote remove "+name)
|
||||
add=#True
|
||||
EndIf
|
||||
Else
|
||||
add=#True
|
||||
EndIf
|
||||
; We add a new remote
|
||||
If add=#True
|
||||
If git("remote add "+name+" "+Url) = 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
|
||||
ProcedureReturn #True
|
||||
EndIf
|
||||
EndProcedure
|
||||
|
||||
Procedure DoPush()
|
||||
If Trim(GetGadgetText(#GID_EdRemote))=""
|
||||
MessageRequester("Git Push", "Échec: " + #LF$ + "You Must tu have a remote", #PB_MessageRequester_Error)
|
||||
EndIf
|
||||
|
||||
If AddRemoteRepo(Trim(GetGadgetText(#GID_EdRemote)))
|
||||
|
||||
If Git("push -u origin "+GetGadgetText(#GID_CbRemoteBranch))
|
||||
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
|
||||
Else
|
||||
Debug"ZOOOOOOOOOOOOOOM"
|
||||
ProcedureReturn #False
|
||||
EndIf
|
||||
EndProcedure
|
||||
|
||||
Procedure.i GetRemoteStatusInfo()
|
||||
; Récupère les informations de status du remote
|
||||
Protected localBranch.s = GetGadgetText(#GID_CbLocalBranch)
|
||||
@@ -1657,8 +1704,8 @@ EndProcedure
|
||||
Main()
|
||||
|
||||
; IDE Options = PureBasic 6.21 (Windows - x64)
|
||||
; CursorPosition = 224
|
||||
; FirstLine = 211
|
||||
; Folding = ----4--
|
||||
; CursorPosition = 952
|
||||
; FirstLine = 948
|
||||
; Folding = ----f--
|
||||
; EnableXP
|
||||
; DPIAware
|
Reference in New Issue
Block a user