@echo off

setlocal
set hgparams=%*

echo executing "hg %hgparams%" for repository and all externals

call :doCmd

call :doExternals buildtools

if not exist libs goto nolibs
pushd libs

call :doExternals dzlib
call :doExternals jcl
call :doExternals dxgettext

popd
endlocal

goto :eof

:nolibs
echo subdir libs is missing.
goto :eof

:doExternals
if not exist %1 goto missing
pushd %1
call :doCmd
popd
goto :eof

:doCmd
echo - handling %CD%
hg %hgparams%
echo -
goto :eof

:missing
echo subdir %1 is missing
goto :eof
