Changeset - r9783:ca11f82b927a
[Not reviewed]
master
0 1 0
glx - 16 years ago 2008-08-02 19:48:54
glx@openttd.org
(svn r13924) -Fix (r11531): determineversion.vbs could fail to find the right version with hg
1 file changed with 16 insertions and 1 deletions:
0 comments (0 inline, 0 general)
projects/determineversion.vbs
Show inline comments
 
@@ -6,13 +6,13 @@ Set FSO = CreateObject("Scripting.FileSy
 
Sub FindReplaceInFile(filename, to_find, replacement)
 
	Dim file, data
 
	Set file = FSO.OpenTextFile(filename, 1, 0, 0)
 
	data = file.ReadAll
 
	file.Close
 
	data = Replace(data, to_find, replacement)
 
	Set file = FSO.CreateTextFile(FileName, -1, 0)
 
	Set file = FSO.CreateTextFile(filename, -1, 0)
 
	file.Write data
 
	file.Close
 
End Sub
 

	
 
Sub UpdateFile(modified, revision, version, cur_date, filename)
 
	FSO.CopyFile filename & ".in", filename
 
@@ -138,12 +138,17 @@ Function DetermineSVNVersion()
 
		' Reset error and version
 
		Err.Clear
 
		version = "norev000"
 
		' Do we have subversion installed? Check immediatelly whether we've got a modified WC.
 
		Set oExec = WshShell.Exec("svnversion ../src")
 
		If Err.Number = 0 Then
 
			' Wait till the application is finished ...
 
			Do While oExec.Status = 0
 
			Loop
 
		End If
 
		If Err.Number = 0 And oExec.ExitCode = 0 Then
 
			Dim modified
 
			If InStr(OExec.StdOut.ReadLine(), "M") Then
 
				modified = "M"
 
			Else
 
				modified = ""
 
			End If
 
@@ -175,12 +180,17 @@ Function DetermineSVNVersion()
 
		End If
 
	Else
 
		' svn detection failed, reset error and try git
 
		Err.Clear
 
		Set oExec = WshShell.Exec("git rev-parse --verify --short=8 HEAD")
 
		If Err.Number = 0 Then
 
			' Wait till the application is finished ...
 
			Do While oExec.Status = 0
 
			Loop
 
		End If
 
		If Err.Number = 0 And oExec.ExitCode = 0 Then
 
			version = "g" & oExec.StdOut.ReadLine()
 
			Set oExec = WshShell.Exec("git diff-index --exit-code --quiet HEAD ../src")
 
			Do While oExec.Status = 0 And Err.Number = 0
 
			Loop
 
			If Err.Number = 0 And oExec.ExitCode = 1 Then
 
				version = version & "M"
 
@@ -196,12 +206,17 @@ Function DetermineSVNVersion()
 
			End If
 
		Else
 
			' try mercurial (hg)
 
			Err.Clear
 
			Set oExec = WshShell.Exec("hg tip")
 
			If Err.Number = 0 Then
 
				' Wait till the application is finished ...
 
				Do While oExec.Status = 0
 
				Loop
 
			End If
 
			If Err.Number = 0 And oExec.ExitCode = 0 Then
 
				version = "h" & Mid(OExec.StdOut.ReadLine(), 19, 8)
 
				Set oExec = WshShell.Exec("hg status ../src")
 
				If Err.Number = 0 Then
 
					Do
 
						line = OExec.StdOut.ReadLine()
 
						If Mid(line, 1, 1) <> "?" Then
0 comments (0 inline, 0 general)