Add version check to support git and svn

This commit is contained in:
Jeff Lenk 2010-04-15 23:00:29 -05:00
parent fc6faf46fb
commit 74bf4b0f2e

View File

@ -308,23 +308,44 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest)
Const ForReading = 1 Const ForReading = 1
if strVerRev = "" Then if strVerRev = "" Then
VersionCmd="fs_svnversion " & quote & VersionDir & "." & quote & " -n" if FSO.FolderExists(VersionDir & ".svn") Then
Set MyFile = fso.CreateTextFile(tmpFolder & "tmpVersion.Bat", True) VersionCmd="fs_svnversion " & quote & VersionDir & "." & quote & " -n"
MyFile.WriteLine("@" & "cd " & quote & tmpFolder & quote ) Set MyFile = fso.CreateTextFile(tmpFolder & "tmpVersion.Bat", True)
MyFile.WriteLine("@" & VersionCmd) MyFile.WriteLine("@" & "cd " & quote & tmpFolder & quote )
MyFile.Close MyFile.WriteLine("@" & VersionCmd)
Set oExec = WshShell.Exec("cmd /C " & quote & tmpFolder & "tmpVersion.Bat" & quote) MyFile.Close
Do Set oExec = WshShell.Exec("cmd /C " & quote & tmpFolder & "tmpVersion.Bat" & quote)
strFromProc = OExec.StdOut.ReadLine() Do
VERSION=strFromProc strFromProc = OExec.StdOut.ReadLine()
Loop While Not OExec.StdOut.atEndOfStream VERSION="svn-" & strFromProc
sLastVersion = "" Loop While Not OExec.StdOut.atEndOfStream
Set sLastFile = FSO.OpenTextFile(tmpFolder & "lastversion", ForReading, true, OpenAsASCII) sLastVersion = ""
If Not sLastFile.atEndOfStream Then Set sLastFile = FSO.OpenTextFile(tmpFolder & "lastversion", ForReading, true, OpenAsASCII)
sLastVersion = sLastFile.ReadLine() If Not sLastFile.atEndOfStream Then
End If sLastVersion = sLastFile.ReadLine()
sLastFile.Close End If
End If sLastFile.Close
End If
if FSO.FolderExists(VersionDir & ".git") Then
VersionCmd="git log --format=" & quote & "%%h %%ci" & quote & " -1 HEAD"
Set MyFile = FSO.CreateTextFile(tmpFolder & "tmpVersion.Bat", True)
MyFile.WriteLine("@" & "cd " & quote & VersionDir & quote)
MyFile.WriteLine("@" & VersionCmd)
MyFile.Close
Set oExec = WshShell.Exec("cmd /C " & quote & tmpFolder & "tmpVersion.Bat" & quote)
Do
strFromProc = Trim(OExec.StdOut.ReadLine())
VERSION="git-" & strFromProc
Loop While Not OExec.StdOut.atEndOfStream
sLastVersion = ""
Set sLastFile = FSO.OpenTextFile(tmpFolder & "lastversion", ForReading, true, OpenAsASCII)
If Not sLastFile.atEndOfStream Then
sLastVersion = sLastFile.ReadLine()
End If
sLastFile.Close
End If
End If
if strVerRev <> "" Then if strVerRev <> "" Then
VERSION = strVerRev VERSION = strVerRev