(svn r14684) -Codechange: use SubWCRev object to get version info instead SubWCRev.exe for tortoiseSVN (Darkvater)

This commit is contained in:
glx 2008-12-16 23:02:22 +00:00
parent c7c65cf5bc
commit 29b73896b4
1 changed files with 13 additions and 26 deletions

View File

@ -82,45 +82,32 @@ Function DetermineSVNVersion()
Set WshShell = CreateObject("WScript.Shell") Set WshShell = CreateObject("WScript.Shell")
On Error Resume Next On Error Resume Next
revision = 0
' Try TortoiseSVN ' Try TortoiseSVN
' Get the directory where TortoiseSVN (should) reside(s) ' Get the directory where TortoiseSVN (should) reside(s)
Dim sTortoise Dim sTortoise
' First, try with 32-bit architecture ' First, try with 32-bit architecture
sTortoise = ReadRegistryKey("HKLM", "SOFTWARE\TortoiseSVN", "Directory", 32) sTortoise = ReadRegistryKey("HKLM", "SOFTWARE\TortoiseSVN", "Directory", 32)
If sTortoise = Nothing Then If sTortoise = "" Then
' No 32-bit version of TortoiseSVN installed, try 64-bit version (doesn't hurt on 32-bit machines, it returns nothing or is ignored) ' No 32-bit version of TortoiseSVN installed, try 64-bit version (doesn't hurt on 32-bit machines, it returns nothing or is ignored)
sTortoise = ReadRegistryKey("HKLM", "SOFTWARE\TortoiseSVN", "Directory", 64) sTortoise = ReadRegistryKey("HKLM", "SOFTWARE\TortoiseSVN", "Directory", 64)
End If End If
' If TortoiseSVN is installed, try to get the revision number ' If TortoiseSVN is installed, try to get the revision number
If sTortoise <> Nothing Then If sTortoise <> "" Then
Dim file Dim SubWCRev
' Write some "magic" to a temporary file so we can acquire the svn revision/state Set SubWCRev = WScript.CreateObject("SubWCRev.object")
Set file = FSO.CreateTextFile("tsvn_tmp", -1, 0) SubWCRev.GetWCInfo FSO.GetAbsolutePathName("../src"), 0, 0
file.WriteLine "r$WCREV$" revision = SubWCRev.Revision
file.WriteLine "$WCURL$" version = "r" & revision
file.WriteLine "$WCMODS?2:0$" modified = 0
file.WriteLine "$WCREV$" if SubWCRev.HasModifications then modified = 2
file.Close url = SubWCRev.Url
Set oExec = WshShell.Exec(sTortoise & "\bin\SubWCRev.exe ../src tsvn_tmp tsvn_tmp")
' Wait till the application is finished ...
Do
OExec.StdOut.ReadLine()
Loop While Not OExec.StdOut.atEndOfStream
Set file = FSO.OpenTextFile("tsvn_tmp", 1, 0, 0)
version = file.ReadLine
url = file.ReadLine
modified = file.ReadLine
revision = file.ReadLine
file.Close
Set file = FSO.GetFile("tsvn_tmp")
file.Delete
End If End If
' Looks like there is no TortoiseSVN installed either. Then we don't know it. ' Looks like there is no TortoiseSVN installed either. Then we don't know it.
If InStr(version, "$") Then If revision = 0 Then
' Reset error and version ' Reset error and version
Err.Clear Err.Clear
version = "norev000" version = "norev000"