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 set GIT_URL=https://chromium.googlesource.com/chromium/tools/depot_tools.git | |
11 | |
10 :: Will download svn and python. | 12 :: Will download svn and python. |
11 :: If you don't want to install the depot_tools version of these tools, remove | 13 :: If you don't want to install the depot_tools version of these tools, remove |
12 :: the 'force' option on the next command. The tools will be installed only if | 14 :: the 'force' option on the next command. The tools will be installed only if |
13 :: not already in the PATH environment variable. | 15 :: not already in the PATH environment variable. |
14 call "%~dp0bootstrap\win\win_tools.bat" force | 16 call "%~dp0bootstrap\win\win_tools.bat" force |
15 if errorlevel 1 goto :EOF | 17 if errorlevel 1 goto :EOF |
16 :: Now clear errorlevel so it can be set by other programs later. | 18 :: Now clear errorlevel so it can be set by other programs later. |
17 set errorlevel= | 19 set errorlevel= |
18 | 20 |
19 :: Shall skip automatic update? | 21 :: Shall skip automatic update? |
20 IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :EOF | 22 IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :EOF |
21 | 23 |
22 :: We need either .\.svn\. or .\.git\. to be able to sync. | 24 :: We need either .\.svn\. or .\.git\. to be able to sync. |
23 IF EXIST "%~dp0.svn\." GOTO :SVN_UPDATE | 25 IF EXIST "%~dp0.svn\." GOTO :SVN_UPDATE |
24 IF EXIST "%~dp0.git\." GOTO :GIT_UPDATE | 26 IF EXIST "%~dp0.git\." GOTO :GIT_UPDATE |
25 echo Error updating depot_tools, no revision tool found. | 27 echo Error updating depot_tools, no revision tool found. |
26 goto :EOF | 28 goto :EOF |
27 | 29 |
28 | 30 |
29 :SVN_UPDATE | 31 :SVN_UPDATE |
30 call svn up -q "%~dp0." | 32 call svn up -q "%~dp0." |
31 goto :EOF | 33 goto :EOF |
32 | 34 |
33 | 35 |
34 :GIT_UPDATE | 36 :GIT_UPDATE |
35 cd /d "%~dp0." | 37 cd /d "%~dp0." |
36 call git config remote.origin.fetch > NUL | 38 call git config remote.origin.fetch > NUL |
37 if errorlevel 1 goto :GIT_SVN_UPDATE | 39 if errorlevel 1 goto :GIT_SVN_UPDATE |
40 for /F %%x in ('git config --get remote.origin.url') DO ( | |
41 IF "%%x" == "%GIT_URL%" ( | |
M-A Ruel
2013/01/07 19:18:11
IF not "%%x" == "%GIT_URL%" (
would work.
szager1
2013/01/07 19:24:57
Done.
| |
42 rem | |
43 ) ELSE ( | |
44 echo Your depot_tools checkout is configured to fetch from an obsolete URL | |
45 choice /N /T 60 /D N /M "Would you like to update it? [y/N]: " | |
46 IF errorlevel 2 ( | |
M-A Ruel
2013/01/07 19:18:11
IF not errorlevel 2 (
szager1
2013/01/07 19:24:57
Done.
| |
47 rem | |
48 ) ELSE ( | |
49 call git config remote.origin.url "%GIT_URL%" | |
50 ) | |
51 ) | |
52 ) | |
38 call git fetch -q origin > NUL | 53 call git fetch -q origin > NUL |
39 call git rebase -q origin/master > NUL | 54 call git rebase -q origin/master > NUL |
40 goto :EOF | 55 goto :EOF |
41 | 56 |
42 :GIT_SVN_UPDATE | 57 :GIT_SVN_UPDATE |
43 cd /d "%~dp0." | 58 cd /d "%~dp0." |
44 call git svn rebase -q -q | 59 call git svn rebase -q -q |
45 goto :EOF | 60 goto :EOF |
OLD | NEW |