Browse Source

update zmp

master
sasbot 4 years ago
parent
commit
e4531fd5a9
1 changed files with 49 additions and 44 deletions
  1. +49
    -44
      Update.cmd

+ 49
- 44
Update.cmd View File

@@ -1,50 +1,55 @@
@echo off
hg incoming "https://bitbucket.org/sas_team/sas.maps/"
::echo %ERRORLEVEL%
IF ERRORLEVEL 9009 goto NoHg
IF ERRORLEVEL 255 goto CloneRepo
IF ERRORLEVEL 2 goto err
IF ERRORLEVEL 1 goto noupdates
IF ERRORLEVEL 0 goto ok
IF ERRORLEVEL -1 goto CloneRepo
set maps_dir=sas.maps
set maps_url="https://github.com/sasgis/sas.maps"
git fetch --verbose %maps_url%
echo %ERRORLEVEL%
if ERRORLEVEL 9009 goto NoGit
if ERRORLEVEL 128 goto CloneRepo
if ERRORLEVEL 0 goto UpdateRepo
if ERRORLEVEL -1 goto CloneRepo
goto err
:ok
echo ‡ ¡¨à ¥¬ ¨§¬¥­¥­¨ï ¨§ ९®§¨â®à¨ï
hg pull "https://bitbucket.org/sas_team/sas.maps/" -u -f
IF ERRORLEVEL 1 goto err
IF NOT ERRORLEVEL 0 goto err
for /R /D %%d in (*.zmp) do rd /q %%d 2> nul
goto end
:CloneRepo
rd /s /q sas.maps
echo „¥« ¥¬ ª«®­ ९®§¨â®à¨ï á á¥à¢¥à 
hg clone "https://bitbucket.org/sas_team/sas.maps/" sas.maps
IF NOT ERRORLEVEL 0 goto err
echo Š®¯¨à㥬 ¯ ¯ªã á ९®§¨â®à¨¥¬ ¨§ ¯®¤¯ ¯ª¨ ¢ ⥪ãéãî ¯ ¯ªã
move /Y sas.maps\.hg .\.hg
IF NOT ERRORLEVEL 0 goto errMoveHg
echo “¤ «ï¥¬ ¢à¥¬¥­­® ᮧ¤ ­­ãî ¯®¤¯ ¯ªã
rd /s /q sas.maps
IF NOT ERRORLEVEL 0 goto errRemoveTemp
echo Ž¡­®¢«ï¥¬ ä ©«ë ¤® ¯®á«¥¤­¥© ¢¥àᨨ
hg update -c
goto end
:noupdates
echo �¥â ­®¢ëå ¨§¬¥­¥­¨©
goto end
:CloneRepo
echo „¥« ¥¬ ª«®­ ९®§¨â®à¨ï á á¥à¢¥à 
rd /s /q %maps_dir%
git clone %maps_url% %maps_dir%
if not ERRORLEVEL 0 goto err
echo Š®¯¨à㥬 ¯ ¯ªã á ९®§¨â®à¨¥¬ ¨§ ¯®¤¯ ¯ª¨ ¢ ⥪ãéãî ¯ ¯ªã
xcopy /i /s /h /e /y %maps_dir%\.git .\.git
if not ERRORLEVEL 0 goto ErrorCopyGit
echo “¤ «ï¥¬ ¢à¥¬¥­­® ᮧ¤ ­­ãî ¯®¤¯ ¯ªã
rd /s /q %maps_dir%
if not ERRORLEVEL 0 goto ErrorRemoveTemp
goto UpdateRepo
:UpdateRepo
echo Ž¡­®¢«ï¥¬ ä ©«ë ¤® ¯®á«¥¤­¥© ¢¥àᨨ
git clean -d --force
git reset --hard
goto end
:err
echo Žè¨¡ª  á¢ï§¨ á á¥à¢¥à®¬
goto end
:errMoveHg
echo Žè¨¡ª  ¯¥à¥¬¥é¥­¨ï ¯ ¯ª¨ .hg
goto end
:errRemoveTemp
echo Žè¨¡ª  㤠«¥­¨ï ¢à¥¬¥­­®© ¯ ¯ª¨ sas.maps
goto end
:NoHg
echo �¥ ãáâ ­®¢«¥­ Mercurial
goto end
echo Žè¨¡ª  á¢ï§¨ á á¥à¢¥à®¬
goto end
:ErrorCopyGit
echo Žè¨¡ª  ª®¯¨à®¢ ­¨ï ¯ ¯ª¨ .git
goto end
:ErrorRemoveTemp
echo Žè¨¡ª  㤠«¥­¨ï ¢à¥¬¥­­®© ¯ ¯ª¨ sas.maps
goto end
:NoGit
echo Žè¨¡ª : �¥ ãáâ ­®¢«¥­ Git
goto end
:end
pause
pause

Loading…
Cancel
Save