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 |
(...skipping 20 matching lines...) Expand all Loading... |
31 IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :EOF | 31 IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :EOF |
32 | 32 |
33 :: We need either .\.svn\. or .\.git\. to be able to sync. | 33 :: We need either .\.svn\. or .\.git\. to be able to sync. |
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 call svn up -q "%DEPOT_TOOLS_DIR%." | 41 FOR %%A IN (%*) DO ( |
| 42 IF "%%A" == "--force" ( |
| 43 call svn -q revert -R "%DEPOT_TOOLS_DIR%." |
| 44 ) |
| 45 ) |
| 46 call svn -q up "%DEPOT_TOOLS_DIR%." |
42 goto :EOF | 47 goto :EOF |
43 | 48 |
44 | 49 |
45 :GIT_UPDATE | 50 :GIT_UPDATE |
46 cd /d "%DEPOT_TOOLS_DIR%." | 51 cd /d "%DEPOT_TOOLS_DIR%." |
47 call git config remote.origin.fetch > NUL | 52 call git config remote.origin.fetch > NUL |
48 if errorlevel 1 goto :GIT_SVN_UPDATE | 53 if errorlevel 1 goto :GIT_SVN_UPDATE |
49 for /F %%x in ('git config --get remote.origin.url') DO ( | 54 for /F %%x in ('git config --get remote.origin.url') DO ( |
50 IF not "%%x" == "%GIT_URL%" ( | 55 IF not "%%x" == "%GIT_URL%" ( |
51 echo Your depot_tools checkout is configured to fetch from an obsolete URL | 56 echo Your depot_tools checkout is configured to fetch from an obsolete URL |
52 choice /N /T 60 /D N /M "Would you like to update it? [y/N]: " | 57 choice /N /T 60 /D N /M "Would you like to update it? [y/N]: " |
53 IF not errorlevel 2 ( | 58 IF not errorlevel 2 ( |
54 call git config remote.origin.url "%GIT_URL%" | 59 call git config remote.origin.url "%GIT_URL%" |
55 ) | 60 ) |
56 ) | 61 ) |
57 ) | 62 ) |
58 call git fetch -q origin > NUL | 63 call git fetch -q origin > NUL |
59 call git rebase -q origin/master > NUL | 64 call git rebase -q origin/master > NUL |
60 if errorlevel 1 echo Failed to update depot_tools. | 65 if errorlevel 1 echo Failed to update depot_tools. |
| 66 goto :EOF |
61 | 67 |
62 goto :EOF | |
63 | 68 |
64 :GIT_SVN_UPDATE | 69 :GIT_SVN_UPDATE |
65 cd /d "%DEPOT_TOOLS_DIR%." | 70 cd /d "%DEPOT_TOOLS_DIR%." |
66 call git svn rebase -q -q | 71 call git svn rebase -q -q |
67 goto :EOF | 72 goto :EOF |
OLD | NEW |