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 | 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 | 11 :: this script off to a temporary location and reinvoke from there before |
12 :: running any svn or git commands. | 12 :: running any git commands. |
13 IF "%~nx0"=="update_depot_tools.bat" ( | 13 IF "%~nx0"=="update_depot_tools.bat" ( |
14 COPY /Y "%~dp0update_depot_tools.bat" "%TEMP%\update_depot_tools_tmp.bat" >nul | 14 COPY /Y "%~dp0update_depot_tools.bat" "%TEMP%\update_depot_tools_tmp.bat" >nul |
15 if errorlevel 1 goto :EOF | 15 if errorlevel 1 goto :EOF |
16 "%TEMP%\update_depot_tools_tmp.bat" "%~dp0" %* | 16 "%TEMP%\update_depot_tools_tmp.bat" "%~dp0" %* |
17 ) | 17 ) |
18 | 18 |
19 set DEPOT_TOOLS_DIR=%~1 | 19 set DEPOT_TOOLS_DIR=%~1 |
20 SHIFT | 20 SHIFT |
21 | 21 |
22 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 |
(...skipping 11 matching lines...) Expand all Loading... |
34 IF EXIST "%DEPOT_TOOLS_DIR%.svn\." GOTO :SVN_UPDATE | 34 IF EXIST "%DEPOT_TOOLS_DIR%.svn\." GOTO :SVN_UPDATE |
35 IF EXIST "%DEPOT_TOOLS_DIR%.git\." GOTO :GIT_UPDATE | 35 IF EXIST "%DEPOT_TOOLS_DIR%.git\." GOTO :GIT_UPDATE |
36 echo Error updating depot_tools, no revision tool found. | 36 echo Error updating depot_tools, no revision tool found. |
37 goto :EOF | 37 goto :EOF |
38 | 38 |
39 | 39 |
40 :SVN_UPDATE | 40 :SVN_UPDATE |
41 echo ======================== | 41 echo ======================== |
42 echo WARNING: You have an SVN checkout of depot_tools! | 42 echo WARNING: You have an SVN checkout of depot_tools! |
43 echo. | 43 echo. |
44 echo depot_tools is migrating to Git on June 6, 2016. If you still have an | 44 echo depot_tools has migrated to Git. You are |
45 echo SVN checkout then, you will STOP RECEIVING UPDATES to depot_tools. | 45 echo NO LONGER RECEIVING UPDATES to depot_tools. |
46 echo. | 46 echo. |
47 echo Before that date, please follow the instructions here[1] to get a Git | 47 echo You must follow these instructions[1] to get a Git copy of depot_tools. |
48 echo copy of depot_tools. | |
49 echo. | 48 echo. |
50 echo [1]: https://www.chromium.org/developers/how-tos/install-depot-tools | 49 echo [1]: https://www.chromium.org/developers/how-tos/install-depot-tools |
51 echo ======================== | 50 echo ======================== |
52 FOR %%A IN (%*) DO ( | |
53 IF "%%A" == "--force" ( | |
54 call svn -q revert -R "%DEPOT_TOOLS_DIR%." | |
55 ) | |
56 ) | |
57 call svn -q up "%DEPOT_TOOLS_DIR%." | |
58 goto :EOF | 51 goto :EOF |
59 | 52 |
60 | 53 |
61 :GIT_UPDATE | 54 :GIT_UPDATE |
62 cd /d "%DEPOT_TOOLS_DIR%." | 55 cd /d "%DEPOT_TOOLS_DIR%." |
63 call git config remote.origin.fetch > NUL | 56 call git config remote.origin.fetch > NUL |
64 if errorlevel 1 goto :GIT_SVN_UPDATE | |
65 for /F %%x in ('git config --get remote.origin.url') DO ( | 57 for /F %%x in ('git config --get remote.origin.url') DO ( |
66 IF not "%%x" == "%GIT_URL%" ( | 58 IF not "%%x" == "%GIT_URL%" ( |
67 echo Your depot_tools checkout is configured to fetch from an obsolete URL | 59 echo Your depot_tools checkout is configured to fetch from an obsolete URL |
68 choice /N /T 60 /D N /M "Would you like to update it? [y/N]: " | 60 choice /N /T 60 /D N /M "Would you like to update it? [y/N]: " |
69 IF not errorlevel 2 ( | 61 IF not errorlevel 2 ( |
70 call git config remote.origin.url "%GIT_URL%" | 62 call git config remote.origin.url "%GIT_URL%" |
71 ) | 63 ) |
72 ) | 64 ) |
73 ) | 65 ) |
74 call git fetch -q origin > NUL | 66 call git fetch -q origin > NUL |
75 call git rebase -q origin/master > NUL | 67 call git rebase -q origin/master > NUL |
76 if errorlevel 1 echo Failed to update depot_tools. | 68 if errorlevel 1 echo Failed to update depot_tools. |
77 goto :EOF | 69 goto :EOF |
78 | |
79 | |
80 :GIT_SVN_UPDATE | |
81 cd /d "%DEPOT_TOOLS_DIR%." | |
82 call git svn rebase -q -q | |
83 goto :EOF | |
OLD | NEW |