-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtag-release.cmd
73 lines (55 loc) · 2.22 KB
/
tag-release.cmd
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
@echo off
cls
set WORK_DIR=%TEMP%\2a4c0b3c4e24492db23a7f3f92506647
set SYNCER_LOG_FILE=%WORK_DIR%\syncer_log.txt
set COMMIT_MESSAGE_FILE=%WORK_DIR%\commit_message.txt
if exist "%WORK_DIR%" rd /q /s "%WORK_DIR%"
set /p HG_PATH="Enter local HG repo path (e.g. C:\work\hg): "
if not exist "%HG_PATH%\.hg" (
echo No Mercurial repo detected at this path
goto error
)
hg pull --cwd "%HG_PATH%"
set /p HG_TAG="Existing Mercurial tag used to build installations (e.g. 17_1_2): "
echo downloading...
hg archive --no-decode --cwd "%HG_PATH%" -r "tag('%HG_TAG%')" --include GitHub "%WORK_DIR%\hg" || goto error
set /p GITHUB_TAG="GitHub tag to be created (e.g. 17.1.2-pre-beta): "
echo preparing commit message...
echo Release %GITHUB_TAG% > "%COMMIT_MESSAGE_FILE%"
hg log --cwd "%HG_PATH%" -r "branch(tagged('%HG_TAG%')) and user('Syncer Bot')" --template " {desc}\r\n" > "%SYNCER_LOG_FILE%"
for /f %%i in ("%SYNCER_LOG_FILE%") do set SYNCER_LOG_FILE_SIZE=%%~zi
if %SYNCER_LOG_FILE_SIZE% gtr 0 (
echo Cherry-picked changesets: >> "%COMMIT_MESSAGE_FILE%"
type "%SYNCER_LOG_FILE%" >> "%COMMIT_MESSAGE_FILE%"
)
echo.
echo Text editor with a pending commit message must open now.
echo If needed, edit and save.
explorer "%COMMIT_MESSAGE_FILE%"
pause
echo.
echo ----------
hg log --cwd "%HG_PATH%" --pager=off -r "sort(last(ancestors(first(branch(tagged('%HG_TAG%')))) and author('Syncer Bot'), 5), -date)" --template "{date|date} {desc}\n"
echo ----------
echo From the list above, choose a parent commit for this release.
echo The topmost (first in the list) should work.
set /p GITHUB_PARENT="commit sha: "
echo.
echo cloning...
git clone https://github.com/DevExpress/DevExtreme.git "%WORK_DIR%\github" || goto error
cd /d "%WORK_DIR%\github"
git checkout "%GITHUB_PARENT%" || goto error
git rm -rf . || goto error
robocopy "%WORK_DIR%\hg\GitHub" "%WORK_DIR%\github" /s /nfl /ndl
IF %ERRORLEVEL% LEQ 1 goto error
git add . || goto error
git update-index --chmod=+x docker-ci.sh testing/launch || goto error
git commit -F "%COMMIT_MESSAGE_FILE%" --allow-empty || goto error
git tag "%GITHUB_TAG%" || goto error
echo ------------------
echo OK, now examine "%WORK_DIR%\github" in SourceTree and push the new tag!
pause
exit /b 0
:error
echo ERRORS
exit /b 1