-
Notifications
You must be signed in to change notification settings - Fork 34
/
PitVersions.bat
50 lines (48 loc) · 1.69 KB
/
PitVersions.bat
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
40
41
42
43
44
45
46
47
48
49
50
@ECHO OFF
SET VER=%~1
SET TAG=%~2
SET MAP=%~3
SET FORCE=%~4
@rem git.exe instead of just git, because some git.cmd commands cause the entire batch script to exit.
where git.exe
if "%errorlevel%"=="1" (
ECHO Tagging %VER% error
ECHO Please install Git as a requirement. Download : https://gitforwindows.org/
exit /b 1
)
git.exe rev-parse --verify --quiet %TAG%
if "%errorlevel%"=="1" (
ECHO Reference %TAG% not found
exit /b 1
)
git.exe diff --quiet %TAG% -- common.eai
if "%errorlevel%"=="1" (
ECHO %TAG% is not compatible because common.eai does not match cross-versions.
if "%FORCE%" neq "1" (
ECHO Install can be forced with PitVersions "%VER%" "%TAG%" "%MAP%" 1
ECHO Exiting
exit /b 1
)
)
if not exist Scripts\%VER%\a\NUL mkdir Scripts\%VER%\a
if not exist Scripts\%VER%\b\NUL mkdir Scripts\%VER%\b
for /f %%a in ('git.exe rev-parse --abbrev-ref HEAD') do set "HEAD_REFNAME=%%a"
for /f %%a in ('git.exe rev-parse HEAD') do set "COMMIT_HASH_A=%%a"
call MakeVERBase.bat %VER% 1
del Scripts\%VER%\a\* /Q
copy Scripts\%VER%\*.ai Scripts\%VER%\a
echo %HEAD_REFNAME%:%COMMIT_HASH_A% > Scripts\%VER%\a\amai_version.txt
echo Tagged HEAD %HEAD_REFNAME% (%COMMIT_HASH_A%) as Version A
git.exe checkout %TAG%
for /f %%a in ('git.exe rev-parse HEAD') do set "COMMIT_HASH_B=%%a"
call MakeVERBase.bat %VER% 1
del Scripts\%VER%\b\* /Q
copy Scripts\%VER%\*.ai Scripts\%VER%\b
ren Scripts\%VER%\b\elf.ai elf2.ai
ren Scripts\%VER%\b\human.ai human2.ai
ren Scripts\%VER%\b\orc.ai orc2.ai
ren Scripts\%VER%\b\undead.ai undead2.ai
echo %TAG%:%COMMIT_HASH_B% > Scripts\%VER%\b\amai_version2.txt
echo Tagged %TAG% (%COMMIT_HASH_B%) as Version B
git.exe checkout %HEAD_REFNAME%
call InstallVERToMap "%VER%" "%MAP%" 3