forked from Aleksoid1978/VideoRenderer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_revision.cmd
More file actions
34 lines (26 loc) · 785 Bytes
/
update_revision.cmd
File metadata and controls
34 lines (26 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@ECHO OFF
SETLOCAL
CD /D %~dp0
ECHO #pragma once > revision.h
SET gitexe="git.exe"
%gitexe% --version
IF /I %ERRORLEVEL%==0 GOTO :GitOK
SET gitexe="c:\Program Files\Git\cmd\git.exe"
IF NOT EXIST %gitexe% set gitexe="c:\Program Files\Git\bin\git.exe"
IF NOT EXIST %gitexe% GOTO :END
:GitOK
%gitexe% log -1 --date=format:%%Y.%%m.%%d --pretty=format:"#define REV_DATE %%ad%%n" >> revision.h
%gitexe% log -1 --pretty=format:"#define REV_HASH %%h%%n" >> revision.h
<nul set /p strTemp=#define REV_BRANCH >> revision.h
%gitexe% symbolic-ref --short HEAD >> revision.h
IF %ERRORLEVEL% NEQ 0 (
ECHO LOCAL >> revision.h
)
<nul set /p strTemp=#define REV_NUM >> revision.h
%gitexe% rev-list --count HEAD >> revision.h
IF %ERRORLEVEL% NEQ 0 (
ECHO 0 >> revision.h
)
:END
ENDLOCAL
EXIT /B