-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_package_base.bat
More file actions
39 lines (30 loc) · 979 Bytes
/
make_package_base.bat
File metadata and controls
39 lines (30 loc) · 979 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
35
36
37
38
39
@echo off
:: 1. prepare
:: git commit id
:: SET git_version_cmd="git describe --abbrev=7 --dirty --always --tags"
SET git_version_cmd="git describe --abbrev=7 --always --tags"
FOR /F "tokens=*" %%i IN (' %git_version_cmd% ') DO SET git_commit_id=%%i
:: include dirty?
Echo.%git_commit_id% | findstr /C:"dirty">nul && (
@echo on
Echo "Hi Guy, your operator was canceled due to local modifications that were not commit to git repository!"
@echo off
SET result="false"
goto end
)
SET result="true"
:: git username
FOR /F "tokens=*" %%i IN (' git config user.name ') DO SET git_user_name=%%i
:: git branch name
FOR /F "tokens=*" %%i IN (' git symbolic-ref --short -q HEAD ') DO SET git_branch_name=%%i
:: 2. system timestamp
SET hour=%time:~0,2%
IF "%hour:~0,1%"==" " (
SET hour_prefix=0
) ELSE (
SET hour_prefix="%hour:~0,1%"
)
SET hour=%hour_prefix%%hour:~1,1%
SET timestamp=%date:~0,4%%date:~5,2%%date:~8,2%%hour%%time:~3,2%%time:~6,2%
:end
@echo on