Version control: Git synchronization of local list of branches.

[DEVELOPMENT ENVIRONMENT]
* NEW: Version control: Git synchronization now updates the local list of branches.
* NEW: Version control: All local and remote branches are now availble.
This commit is contained in:
gambas 2020-06-09 22:40:35 +02:00
parent acf3f892c5
commit 08a574c273

View file

@ -72,18 +72,34 @@ Public Sub GetBranches(ByRef sCurrent As String) As String[]
Dim sResult As String
Dim sBranch As String
Dim aBranches As New String[]
Dim bCurrent As Boolean
sResult = RunShell("git branch", True)
sResult = RunShell("git branch -a", True)
For Each sBranch In Split(Trim(sResult), "\n")
sBranch = Trim(sBranch)
If sBranch Begins "*" Then
sBranch = Trim(Mid$(sBranch, 2))
sCurrent = sBranch
bCurrent = True
Else
bCurrent = False
Endif
aBranches.Add(sBranch)
If sBranch Begins "remotes/origin/" Then
sBranch = Mid$(sBranch, 16)
If InStr(sBranch, " -> ") Then Continue
Endif
If bCurrent Then sCurrent = sBranch
If Not aBranches.Exist(sBranch) Then aBranches.Add(sBranch)
Next
aBranches.Sort(gb.Natural)
Return aBranches
End
@ -181,6 +197,8 @@ Public Sub Update() As Integer
aEnv = VersionControl.LANG_ENV.Copy()
aEnv.Add("PWD=" & Project.Dir)
VersionControl.Run(["git", "remote", "update", "origin", "--prune"], True, True, aEnv)
Return VersionControl.Run(["git", "pull", "-q"], True, True, aEnv)
End