mirror of https://github.com/OpenTTD/OpenTTD
(svn r14242) -Fix: removed some possible infinite loop in version determination (again).
parent
8ca4d34aad
commit
199a53c4ca
|
@ -138,24 +138,26 @@ Function DetermineSVNVersion()
|
||||||
' Reset error and version
|
' Reset error and version
|
||||||
Err.Clear
|
Err.Clear
|
||||||
version = "norev000"
|
version = "norev000"
|
||||||
|
|
||||||
|
' Set the environment to english
|
||||||
|
WshShell.Environment("PROCESS")("LANG") = "en"
|
||||||
|
|
||||||
' Do we have subversion installed? Check immediatelly whether we've got a modified WC.
|
' Do we have subversion installed? Check immediatelly whether we've got a modified WC.
|
||||||
Set oExec = WshShell.Exec("svnversion ../src")
|
Set oExec = WshShell.Exec("svnversion ../src")
|
||||||
If Err.Number = 0 Then
|
If Err.Number = 0 Then
|
||||||
' Wait till the application is finished ...
|
' Wait till the application is finished ...
|
||||||
Do While oExec.Status = 0
|
Do While oExec.Status = 0
|
||||||
Loop
|
Loop
|
||||||
End If
|
|
||||||
If Err.Number = 0 And oExec.ExitCode = 0 Then
|
line = OExec.StdOut.ReadLine()
|
||||||
|
If line <> "exported" Then
|
||||||
Dim modified
|
Dim modified
|
||||||
If InStr(OExec.StdOut.ReadLine(), "M") Then
|
If InStr(line, "M") Then
|
||||||
modified = "M"
|
modified = "M"
|
||||||
Else
|
Else
|
||||||
modified = ""
|
modified = ""
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' Set the environment to english
|
|
||||||
WshShell.Environment("PROCESS")("LANG") = "en"
|
|
||||||
|
|
||||||
' And use svn info to get the correct revision and branch information.
|
' And use svn info to get the correct revision and branch information.
|
||||||
Set oExec = WshShell.Exec("svn info ../src")
|
Set oExec = WshShell.Exec("svn info ../src")
|
||||||
If Err.Number = 0 Then
|
If Err.Number = 0 Then
|
||||||
|
@ -168,9 +170,10 @@ Function DetermineSVNVersion()
|
||||||
version = "r" & Mid(line, 19) & modified
|
version = "r" & Mid(line, 19) & modified
|
||||||
End If
|
End If
|
||||||
Loop While Not OExec.StdOut.atEndOfStream
|
Loop While Not OExec.StdOut.atEndOfStream
|
||||||
End If
|
End If ' Err.Number = 0
|
||||||
End If
|
End If ' line <> "exported"
|
||||||
End If
|
End If ' Err.Number = 0
|
||||||
|
End If ' InStr(version, "$")
|
||||||
|
|
||||||
If version <> "norev000" Then
|
If version <> "norev000" Then
|
||||||
If InStr(url, "branches") Then
|
If InStr(url, "branches") Then
|
||||||
|
@ -178,7 +181,7 @@ Function DetermineSVNVersion()
|
||||||
url = Mid(url, 1, InStr(2, url, "/") - 1)
|
url = Mid(url, 1, InStr(2, url, "/") - 1)
|
||||||
version = version & Replace(url, "/", "-")
|
version = version & Replace(url, "/", "-")
|
||||||
End If
|
End If
|
||||||
Else
|
Else ' version <> "norev000"
|
||||||
' svn detection failed, reset error and try git
|
' svn detection failed, reset error and try git
|
||||||
Err.Clear
|
Err.Clear
|
||||||
Set oExec = WshShell.Exec("git rev-parse --verify --short=8 HEAD")
|
Set oExec = WshShell.Exec("git rev-parse --verify --short=8 HEAD")
|
||||||
|
@ -186,15 +189,18 @@ Function DetermineSVNVersion()
|
||||||
' Wait till the application is finished ...
|
' Wait till the application is finished ...
|
||||||
Do While oExec.Status = 0
|
Do While oExec.Status = 0
|
||||||
Loop
|
Loop
|
||||||
End If
|
|
||||||
If Err.Number = 0 And oExec.ExitCode = 0 Then
|
If oExec.ExitCode = 0 Then
|
||||||
version = "g" & oExec.StdOut.ReadLine()
|
version = "g" & oExec.StdOut.ReadLine()
|
||||||
Set oExec = WshShell.Exec("git diff-index --exit-code --quiet HEAD ../src")
|
Set oExec = WshShell.Exec("git diff-index --exit-code --quiet HEAD ../src")
|
||||||
Do While oExec.Status = 0 And Err.Number = 0
|
If Err.Number = 0 Then
|
||||||
|
' Wait till the application is finished ...
|
||||||
|
Do While oExec.Status = 0
|
||||||
Loop
|
Loop
|
||||||
If Err.Number = 0 And oExec.ExitCode = 1 Then
|
|
||||||
|
If oExec.ExitCode = 1 Then
|
||||||
version = version & "M"
|
version = version & "M"
|
||||||
End If
|
End If ' oExec.ExitCode = 1
|
||||||
|
|
||||||
Set oExec = WshShell.Exec("git symbolic-ref HEAD")
|
Set oExec = WshShell.Exec("git symbolic-ref HEAD")
|
||||||
If Err.Number = 0 Then
|
If Err.Number = 0 Then
|
||||||
|
@ -202,18 +208,22 @@ Function DetermineSVNVersion()
|
||||||
line = Mid(line, InStrRev(line, "/") + 1)
|
line = Mid(line, InStrRev(line, "/") + 1)
|
||||||
If line <> "master" Then
|
If line <> "master" Then
|
||||||
version = version & "-" & line
|
version = version & "-" & line
|
||||||
End If
|
End If ' line <> "master"
|
||||||
End If
|
End If ' Err.Number = 0
|
||||||
Else
|
End If ' Err.Number = 0
|
||||||
' try mercurial (hg)
|
End If ' oExec.ExitCode = 0
|
||||||
|
End If ' Err.Number = 0
|
||||||
|
|
||||||
|
If version = "norev000" Then
|
||||||
|
' git detection failed, reset error and try mercurial (hg)
|
||||||
Err.Clear
|
Err.Clear
|
||||||
Set oExec = WshShell.Exec("hg tip")
|
Set oExec = WshShell.Exec("hg tip")
|
||||||
If Err.Number = 0 Then
|
If Err.Number = 0 Then
|
||||||
' Wait till the application is finished ...
|
' Wait till the application is finished ...
|
||||||
Do While oExec.Status = 0
|
Do While oExec.Status = 0
|
||||||
Loop
|
Loop
|
||||||
End If
|
|
||||||
If Err.Number = 0 And oExec.ExitCode = 0 Then
|
If oExec.ExitCode = 0 Then
|
||||||
line = OExec.StdOut.ReadLine()
|
line = OExec.StdOut.ReadLine()
|
||||||
version = "h" & Mid(line, InStrRev(line, ":") + 1, 8)
|
version = "h" & Mid(line, InStrRev(line, ":") + 1, 8)
|
||||||
Set oExec = WshShell.Exec("hg status ../src")
|
Set oExec = WshShell.Exec("hg status ../src")
|
||||||
|
@ -223,19 +233,21 @@ Function DetermineSVNVersion()
|
||||||
If Len(line) > 0 And Mid(line, 1, 1) <> "?" Then
|
If Len(line) > 0 And Mid(line, 1, 1) <> "?" Then
|
||||||
version = version & "M"
|
version = version & "M"
|
||||||
Exit Do
|
Exit Do
|
||||||
End If
|
End If ' Len(line) > 0 And Mid(line, 1, 1) <> "?"
|
||||||
Loop While Not OExec.StdOut.atEndOfStream
|
Loop While Not OExec.StdOut.atEndOfStream
|
||||||
End If
|
|
||||||
Set oExec = WshShell.Exec("hg branch")
|
Set oExec = WshShell.Exec("hg branch")
|
||||||
If Err.Number = 0 Then
|
If Err.Number = 0 Then
|
||||||
line = OExec.StdOut.ReadLine()
|
line = OExec.StdOut.ReadLine()
|
||||||
If line <> "default" Then
|
If line <> "default" Then
|
||||||
version = version & "-" & line
|
version = version & "-" & line
|
||||||
End If
|
End If ' line <> "default"
|
||||||
End If
|
End If ' Err.Number = 0
|
||||||
End If
|
End If ' Err.Number = 0
|
||||||
End If
|
End If ' oExec.ExitCode = 0
|
||||||
End If
|
End If ' Err.Number = 0
|
||||||
|
End If ' version = "norev000"
|
||||||
|
End If ' version <> "norev000"
|
||||||
|
|
||||||
DetermineSVNVersion = version
|
DetermineSVNVersion = version
|
||||||
End Function
|
End Function
|
||||||
|
|
Loading…
Reference in New Issue