-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathincoming.bat
More file actions
25 lines (22 loc) · 784 Bytes
/
Copy pathincoming.bat
File metadata and controls
25 lines (22 loc) · 784 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
echo off
echo Starting incoming hook with onNewBranch: %1 onExistingBranch: %2 onCloseBranch: %3
SETLOCAL
FOR /F "tokens=*" %%a in ('hg log --rev %HG_NODE% --template "{branch}\n"') do SET BRANCH=%%a
set first=hg log -r "min(branch(%BRANCH%))" --template "{node}\n"
set closed=hg log -r "closed() and branch(%BRANCH%)" --template "{node}\n"
FOR /F "tokens=*" %%f in ('%first%') do SET INITIAL=%%f
rem On new branch
if "%HG_NODE%"=="%INITIAL%" (
if not "%~1"=="" call %~1 "%BRANCH%" "%HG_NODE%"
goto done
)
FOR /F "tokens=*" %%f in ('%closed%') do SET CLOSE=%%f
rem On close branch
if "%HG_NODE%"=="%CLOSE%" (
if not "%~3"=="" call %~3 "%BRANCH%" "%HG_NODE%"
goto done
)
rem On existing branch
if not "%~2"=="" call %~2 "%BRANCH%" "%HG_NODE%"
goto done
:done