136 ' Looks like there is no TortoiseSVN installed either. Then we don't know it. |
136 ' Looks like there is no TortoiseSVN installed either. Then we don't know it. |
137 If InStr(version, "$") Then |
137 If InStr(version, "$") Then |
138 ' Reset error and version |
138 ' Reset error and version |
139 Err.Clear |
139 Err.Clear |
140 version = "norev000" |
140 version = "norev000" |
|
141 |
|
142 ' Set the environment to english |
|
143 WshShell.Environment("PROCESS")("LANG") = "en" |
|
144 |
141 ' Do we have subversion installed? Check immediatelly whether we've got a modified WC. |
145 ' Do we have subversion installed? Check immediatelly whether we've got a modified WC. |
142 Set oExec = WshShell.Exec("svnversion ../src") |
146 Set oExec = WshShell.Exec("svnversion ../src") |
143 If Err.Number = 0 Then |
147 If Err.Number = 0 Then |
144 ' Wait till the application is finished ... |
148 ' Wait till the application is finished ... |
145 Do While oExec.Status = 0 |
149 Do While oExec.Status = 0 |
146 Loop |
150 Loop |
147 End If |
151 |
148 If Err.Number = 0 And oExec.ExitCode = 0 Then |
152 line = OExec.StdOut.ReadLine() |
149 Dim modified |
153 If line <> "exported" Then |
150 If InStr(OExec.StdOut.ReadLine(), "M") Then |
154 Dim modified |
151 modified = "M" |
155 If InStr(line, "M") Then |
152 Else |
156 modified = "M" |
153 modified = "" |
157 Else |
154 End If |
158 modified = "" |
155 |
159 End If |
156 ' Set the environment to english |
160 |
157 WshShell.Environment("PROCESS")("LANG") = "en" |
161 ' And use svn info to get the correct revision and branch information. |
158 |
162 Set oExec = WshShell.Exec("svn info ../src") |
159 ' And use svn info to get the correct revision and branch information. |
163 If Err.Number = 0 Then |
160 Set oExec = WshShell.Exec("svn info ../src") |
164 Do |
161 If Err.Number = 0 Then |
165 line = OExec.StdOut.ReadLine() |
162 Do |
166 If InStr(line, "URL") Then |
163 line = OExec.StdOut.ReadLine() |
167 url = line |
164 If InStr(line, "URL") Then |
168 End If |
165 url = line |
169 If InStr(line, "Last Changed Rev") Then |
166 End If |
170 version = "r" & Mid(line, 19) & modified |
167 If InStr(line, "Last Changed Rev") Then |
171 End If |
168 version = "r" & Mid(line, 19) & modified |
172 Loop While Not OExec.StdOut.atEndOfStream |
169 End If |
173 End If ' Err.Number = 0 |
170 Loop While Not OExec.StdOut.atEndOfStream |
174 End If ' line <> "exported" |
171 End If |
175 End If ' Err.Number = 0 |
172 End If |
176 End If ' InStr(version, "$") |
173 End If |
|
174 |
177 |
175 If version <> "norev000" Then |
178 If version <> "norev000" Then |
176 If InStr(url, "branches") Then |
179 If InStr(url, "branches") Then |
177 url = Mid(url, InStr(url, "branches") + 8) |
180 url = Mid(url, InStr(url, "branches") + 8) |
178 url = Mid(url, 1, InStr(2, url, "/") - 1) |
181 url = Mid(url, 1, InStr(2, url, "/") - 1) |
179 version = version & Replace(url, "/", "-") |
182 version = version & Replace(url, "/", "-") |
180 End If |
183 End If |
181 Else |
184 Else ' version <> "norev000" |
182 ' svn detection failed, reset error and try git |
185 ' svn detection failed, reset error and try git |
183 Err.Clear |
186 Err.Clear |
184 Set oExec = WshShell.Exec("git rev-parse --verify --short=8 HEAD") |
187 Set oExec = WshShell.Exec("git rev-parse --verify --short=8 HEAD") |
185 If Err.Number = 0 Then |
188 If Err.Number = 0 Then |
186 ' Wait till the application is finished ... |
189 ' Wait till the application is finished ... |
187 Do While oExec.Status = 0 |
190 Do While oExec.Status = 0 |
188 Loop |
191 Loop |
189 End If |
192 |
190 If Err.Number = 0 And oExec.ExitCode = 0 Then |
193 If oExec.ExitCode = 0 Then |
191 version = "g" & oExec.StdOut.ReadLine() |
194 version = "g" & oExec.StdOut.ReadLine() |
192 Set oExec = WshShell.Exec("git diff-index --exit-code --quiet HEAD ../src") |
195 Set oExec = WshShell.Exec("git diff-index --exit-code --quiet HEAD ../src") |
193 Do While oExec.Status = 0 And Err.Number = 0 |
196 If Err.Number = 0 Then |
194 Loop |
197 ' Wait till the application is finished ... |
195 If Err.Number = 0 And oExec.ExitCode = 1 Then |
198 Do While oExec.Status = 0 |
196 version = version & "M" |
199 Loop |
197 End If |
200 |
198 |
201 If oExec.ExitCode = 1 Then |
199 Set oExec = WshShell.Exec("git symbolic-ref HEAD") |
202 version = version & "M" |
200 If Err.Number = 0 Then |
203 End If ' oExec.ExitCode = 1 |
201 line = oExec.StdOut.ReadLine() |
204 |
202 line = Mid(line, InStrRev(line, "/") + 1) |
205 Set oExec = WshShell.Exec("git symbolic-ref HEAD") |
203 If line <> "master" Then |
206 If Err.Number = 0 Then |
204 version = version & "-" & line |
207 line = oExec.StdOut.ReadLine() |
205 End If |
208 line = Mid(line, InStrRev(line, "/") + 1) |
206 End If |
209 If line <> "master" Then |
207 Else |
210 version = version & "-" & line |
208 ' try mercurial (hg) |
211 End If ' line <> "master" |
|
212 End If ' Err.Number = 0 |
|
213 End If ' Err.Number = 0 |
|
214 End If ' oExec.ExitCode = 0 |
|
215 End If ' Err.Number = 0 |
|
216 |
|
217 If version = "norev000" Then |
|
218 ' git detection failed, reset error and try mercurial (hg) |
209 Err.Clear |
219 Err.Clear |
210 Set oExec = WshShell.Exec("hg tip") |
220 Set oExec = WshShell.Exec("hg tip") |
211 If Err.Number = 0 Then |
221 If Err.Number = 0 Then |
212 ' Wait till the application is finished ... |
222 ' Wait till the application is finished ... |
213 Do While oExec.Status = 0 |
223 Do While oExec.Status = 0 |
214 Loop |
224 Loop |
215 End If |
225 |
216 If Err.Number = 0 And oExec.ExitCode = 0 Then |
226 If oExec.ExitCode = 0 Then |
217 line = OExec.StdOut.ReadLine() |
227 line = OExec.StdOut.ReadLine() |
218 version = "h" & Mid(line, InStrRev(line, ":") + 1, 8) |
228 version = "h" & Mid(line, InStrRev(line, ":") + 1, 8) |
219 Set oExec = WshShell.Exec("hg status ../src") |
229 Set oExec = WshShell.Exec("hg status ../src") |
220 If Err.Number = 0 Then |
230 If Err.Number = 0 Then |
221 Do |
231 Do |
222 line = OExec.StdOut.ReadLine() |
232 line = OExec.StdOut.ReadLine() |
223 If Len(line) > 0 And Mid(line, 1, 1) <> "?" Then |
233 If Len(line) > 0 And Mid(line, 1, 1) <> "?" Then |
224 version = version & "M" |
234 version = version & "M" |
225 Exit Do |
235 Exit Do |
226 End If |
236 End If ' Len(line) > 0 And Mid(line, 1, 1) <> "?" |
227 Loop While Not OExec.StdOut.atEndOfStream |
237 Loop While Not OExec.StdOut.atEndOfStream |
228 End If |
238 |
229 Set oExec = WshShell.Exec("hg branch") |
239 Set oExec = WshShell.Exec("hg branch") |
230 If Err.Number = 0 Then |
240 If Err.Number = 0 Then |
231 line = OExec.StdOut.ReadLine() |
241 line = OExec.StdOut.ReadLine() |
232 If line <> "default" Then |
242 If line <> "default" Then |
233 version = version & "-" & line |
243 version = version & "-" & line |
234 End If |
244 End If ' line <> "default" |
235 End If |
245 End If ' Err.Number = 0 |
236 End If |
246 End If ' Err.Number = 0 |
237 End If |
247 End If ' oExec.ExitCode = 0 |
238 End If |
248 End If ' Err.Number = 0 |
|
249 End If ' version = "norev000" |
|
250 End If ' version <> "norev000" |
239 |
251 |
240 DetermineSVNVersion = version |
252 DetermineSVNVersion = version |
241 End Function |
253 End Function |
242 |
254 |
243 Function IsCachedVersion(version) |
255 Function IsCachedVersion(version) |