| OLD | NEW |
| 1 @echo off | 1 @echo off |
| 2 :: Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 :: Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 :: Use of this source code is governed by a BSD-style license that can be | 3 :: Use of this source code is governed by a BSD-style license that can be |
| 4 :: found in the LICENSE file. | 4 :: found in the LICENSE file. |
| 5 | 5 |
| 6 :: This batch file will try to sync the root directory. | 6 :: This batch file will try to sync the root directory. |
| 7 | 7 |
| 8 setlocal | 8 setlocal |
| 9 | 9 |
| 10 :: Windows freaks out if a file is overwritten while it's being executed. Copy |
| 11 :: this script off to a temporary location and reinvoke from there before |
| 12 :: running any svn or git commands. |
| 13 IF %~nx0==update_depot_tools.bat ( |
| 14 COPY /Y %~dp0update_depot_tools.bat %TEMP%\update_depot_tools_tmp.bat >nul |
| 15 if errorlevel 1 goto :EOF |
| 16 %TEMP%\update_depot_tools_tmp.bat %~dp0 %* |
| 17 ) |
| 18 |
| 19 set DEPOT_TOOLS_DIR=%1 |
| 20 SHIFT |
| 21 |
| 10 set GIT_URL=https://chromium.googlesource.com/chromium/tools/depot_tools.git | 22 set GIT_URL=https://chromium.googlesource.com/chromium/tools/depot_tools.git |
| 11 | 23 |
| 12 :: Will download svn and python. | 24 :: Will download svn and python. |
| 13 :: If you don't want to install the depot_tools version of these tools, remove | 25 :: If you don't want to install the depot_tools version of these tools, remove |
| 14 :: the 'force' option on the next command. The tools will be installed only if | 26 :: the 'force' option on the next command. The tools will be installed only if |
| 15 :: not already in the PATH environment variable. | 27 :: not already in the PATH environment variable. |
| 16 call "%~dp0bootstrap\win\win_tools.bat" force | 28 call "%DEPOT_TOOLS_DIR%bootstrap\win\win_tools.bat" force |
| 17 if errorlevel 1 goto :EOF | 29 if errorlevel 1 goto :EOF |
| 18 :: Now clear errorlevel so it can be set by other programs later. | 30 :: Now clear errorlevel so it can be set by other programs later. |
| 19 set errorlevel= | 31 set errorlevel= |
| 20 | 32 |
| 21 :: Shall skip automatic update? | 33 :: Shall skip automatic update? |
| 22 IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :EOF | 34 IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :EOF |
| 23 | 35 |
| 24 :: We need either .\.svn\. or .\.git\. to be able to sync. | 36 :: We need either .\.svn\. or .\.git\. to be able to sync. |
| 25 IF EXIST "%~dp0.svn\." GOTO :SVN_UPDATE | 37 IF EXIST "%DEPOT_TOOLS_DIR%.svn\." GOTO :SVN_UPDATE |
| 26 IF EXIST "%~dp0.git\." GOTO :GIT_UPDATE | 38 IF EXIST "%DEPOT_TOOLS_DIR%.git\." GOTO :GIT_UPDATE |
| 27 echo Error updating depot_tools, no revision tool found. | 39 echo Error updating depot_tools, no revision tool found. |
| 28 goto :EOF | 40 goto :EOF |
| 29 | 41 |
| 30 | 42 |
| 31 :SVN_UPDATE | 43 :SVN_UPDATE |
| 32 call svn up -q "%~dp0." | 44 call svn up -q "%DEPOT_TOOLS_DIR%." |
| 33 goto :EOF | 45 goto :EOF |
| 34 | 46 |
| 35 | 47 |
| 36 :GIT_UPDATE | 48 :GIT_UPDATE |
| 37 cd /d "%~dp0." | 49 cd /d "%DEPOT_TOOLS_DIR%." |
| 38 call git config remote.origin.fetch > NUL | 50 call git config remote.origin.fetch > NUL |
| 39 if errorlevel 1 goto :GIT_SVN_UPDATE | 51 if errorlevel 1 goto :GIT_SVN_UPDATE |
| 40 for /F %%x in ('git config --get remote.origin.url') DO ( | 52 for /F %%x in ('git config --get remote.origin.url') DO ( |
| 41 IF not "%%x" == "%GIT_URL%" ( | 53 IF not "%%x" == "%GIT_URL%" ( |
| 42 echo Your depot_tools checkout is configured to fetch from an obsolete URL | 54 echo Your depot_tools checkout is configured to fetch from an obsolete URL |
| 43 choice /N /T 60 /D N /M "Would you like to update it? [y/N]: " | 55 choice /N /T 60 /D N /M "Would you like to update it? [y/N]: " |
| 44 IF not errorlevel 2 ( | 56 IF not errorlevel 2 ( |
| 45 call git config remote.origin.url "%GIT_URL%" | 57 call git config remote.origin.url "%GIT_URL%" |
| 46 ) | 58 ) |
| 47 ) | 59 ) |
| 48 ) | 60 ) |
| 49 call git fetch -q origin > NUL | 61 call git fetch -q origin > NUL |
| 50 call git rebase -q origin/master > NUL | 62 call git rebase -q origin/master > NUL |
| 51 goto :EOF | 63 goto :EOF |
| 52 | 64 |
| 53 :GIT_SVN_UPDATE | 65 :GIT_SVN_UPDATE |
| 54 cd /d "%~dp0." | 66 cd /d "%DEPOT_TOOLS_DIR%." |
| 55 call git svn rebase -q -q | 67 call git svn rebase -q -q |
| 56 goto :EOF | 68 goto :EOF |
| OLD | NEW |