improvement AddRemoteRepo
This commit is contained in:
46
main.pb
46
main.pb
@@ -1261,24 +1261,31 @@ EndProcedure
|
||||
Procedure AddRemoteRepo(Url.s,name.s="origin")
|
||||
Url=_SupTrim(Url)
|
||||
name=_SupTrim(name)
|
||||
Debug "Url="+Url
|
||||
Debug "name="+name
|
||||
Protected add.b=#False
|
||||
;Check if this remote already exists
|
||||
main\Gitcall\args = "remote get-url "+name
|
||||
If RunExe(@main\Gitcall) = 0
|
||||
;if yes we remove it
|
||||
If Url<>_SupTrim(main\Gitcall\output)
|
||||
main\Gitcall\args = "remote remove "+name
|
||||
RunExe(@main\Gitcall)
|
||||
add=#True
|
||||
EndIf
|
||||
Else
|
||||
add=#True
|
||||
EndIf
|
||||
; We add a new remote
|
||||
If add=#True
|
||||
main\Gitcall\args = "remote add "+name+" "+Url
|
||||
If RunExe(@main\Gitcall) = 0
|
||||
MessageRequester("Git Remote", "OK:" + #LF$ + main\Gitcall\output, #PB_MessageRequester_Info)
|
||||
;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 GetRemoteUrl(name.s="origin")
|
||||
@@ -1823,6 +1830,7 @@ Procedure RefreshFileList(null.i)
|
||||
DisableGadget(#GdtBtnRefresh,#False)
|
||||
GetBranchesList()
|
||||
GetRemoteUrl()
|
||||
GetCommitHistory()
|
||||
EndProcedure
|
||||
|
||||
Procedure UpdateHelp(txt.s)
|
||||
@@ -2108,10 +2116,10 @@ WebViewGadget(#GdtHelp, helpX, helpY, helpW, helpH)
|
||||
InitGadget()
|
||||
_SetTooltips()
|
||||
If FileSize(".git")=-2:main\info\isInit=#True:EndIf
|
||||
If main\info\isInit=#True
|
||||
GetRemoteUrl("origin")
|
||||
GetCommitHistory()
|
||||
EndIf
|
||||
;If main\info\isInit=#True
|
||||
; GetRemoteUrl("origin")
|
||||
; GetCommitHistory()
|
||||
;;EndIf
|
||||
|
||||
GetBranchesList()
|
||||
|
||||
@@ -2124,7 +2132,8 @@ WebViewGadget(#GdtHelp, helpX, helpY, helpW, helpH)
|
||||
Quit=#True
|
||||
Case #PB_Event_Gadget
|
||||
Select EventGadget()
|
||||
Case #gdtPnl
|
||||
Case #GdtPnl
|
||||
Debug "Click>#gdtPnl"
|
||||
If EventType()=#PB_EventType_Change
|
||||
ReadGitIgnorefile()
|
||||
Select GetGadgetState(#GdtPnl)
|
||||
@@ -2134,17 +2143,22 @@ WebViewGadget(#GdtHelp, helpX, helpY, helpW, helpH)
|
||||
|
||||
EndIf
|
||||
Case #GdtBtnInit
|
||||
Debug "Click>#GdtBtnInit"
|
||||
DoInit()
|
||||
CreateThread(@RefreshFileList(),0)
|
||||
Case #GdtBtnRefresh
|
||||
Debug "Click>#GdtBtnRefresh"
|
||||
CreateThread(@RefreshFileList(),0)
|
||||
Case #GgtFieldRepo
|
||||
|
||||
If EventType()=#PB_EventType_LostFocus
|
||||
Debug "Click>#GgtFieldRepo"
|
||||
main\GitCall\workdir=GetGadgetText(#GgtFieldRepo)
|
||||
CreateThread(@RefreshFileList(),0)
|
||||
EndIf
|
||||
|
||||
Case #GdtBtnBrowseRepo
|
||||
Debug "Click>#GdtBtnBrowseRepo"
|
||||
Protected path.s=PathRequester("Select Folder",main\GitCall\workdir,WindowID(#WinMain))
|
||||
If path<>"" And FileSize(path)=-2
|
||||
main\GitCall\workdir=path
|
||||
@@ -2158,15 +2172,21 @@ WebViewGadget(#GdtHelp, helpX, helpY, helpW, helpH)
|
||||
; EndIf
|
||||
|
||||
Case #GdtBtnClone
|
||||
Debug "Click>#GdtBtnClone"
|
||||
DoClone()
|
||||
Case #GdtBtnPush
|
||||
Debug "Click>#GdtBtnPush"
|
||||
DoPush()
|
||||
Case #GdtBtnPull
|
||||
Debug "Click>#GdtBtnPull"
|
||||
DoPull()
|
||||
Case #GdtListStatus
|
||||
Debug "Click>#GdtListStatus"
|
||||
Case #GdtBtnIgnore
|
||||
Debug "Click>#GdtBtnIgnore"
|
||||
ToggleGitIgnoreForSelection()
|
||||
Case #GdtBtnSaveGitIgnore
|
||||
Debug "Click>#GdtBtnSaveGitIgnore"
|
||||
Protected hf.i=CreateFile(#PB_Any,".gitignore")
|
||||
If hf
|
||||
WriteString(hf,GetGadgetText(#GdtTxtGitIgnore))
|
||||
@@ -2174,18 +2194,24 @@ WebViewGadget(#GdtHelp, helpX, helpY, helpW, helpH)
|
||||
EndIf
|
||||
|
||||
Case #GdtBtnCommit
|
||||
Debug "Click>#GdtBtnCommit"
|
||||
DoCommit()
|
||||
Case #GdtFieldRemote
|
||||
Debug "Click>#GdtFieldRemote"
|
||||
|
||||
Case #GdtListHistory
|
||||
Debug "Click>#GdtListHistory"
|
||||
If EventType() = #PB_EventType_Change
|
||||
ShowSelectedCommitInfo()
|
||||
EndIf
|
||||
|
||||
Case #GdtSlctBranch
|
||||
Debug "Click>#GdtSlctBranch"
|
||||
Case #GdtSlctScope
|
||||
Debug "Click>#GdtSlctScope"
|
||||
GetGitIdentity()
|
||||
Case #GdtBtnSaveCfg
|
||||
Debug "Click>#GdtBtnSaveCfg"
|
||||
SetGitIdentity()
|
||||
|
||||
|
||||
@@ -2202,8 +2228,8 @@ OpenGUI()
|
||||
|
||||
|
||||
; IDE Options = PureBasic 6.21 (Windows - x64)
|
||||
; CursorPosition = 541
|
||||
; FirstLine = 509
|
||||
; CursorPosition = 2191
|
||||
; FirstLine = 2180
|
||||
; Folding = ----------
|
||||
; Optimizer
|
||||
; EnableThread
|
||||
|
Reference in New Issue
Block a user