blob: ec1108c5209737ee294e08011ff90a8e760cd8a4 [file] [log] [blame]
[email protected]805133d2014-02-21 20:38:011@echo off
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
4:: found in the LICENSE file.
5
6:: This batch file will try to sync the root directory.
7
8setlocal
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
Aaron Gablea0e5cc42016-06-21 14:22:1812:: running any git commands.
[email protected]851c8292015-08-12 14:24:3813IF "%~nx0"=="update_depot_tools.bat" (
14 COPY /Y "%~dp0update_depot_tools.bat" "%TEMP%\update_depot_tools_tmp.bat" >nul
[email protected]805133d2014-02-21 20:38:0115 if errorlevel 1 goto :EOF
[email protected]851c8292015-08-12 14:24:3816 "%TEMP%\update_depot_tools_tmp.bat" "%~dp0" %*
[email protected]805133d2014-02-21 20:38:0117)
18
[email protected]851c8292015-08-12 14:24:3819set DEPOT_TOOLS_DIR=%~1
[email protected]805133d2014-02-21 20:38:0120SHIFT
21
Dan Jacques74d7e132017-06-01 22:17:1522IF EXIST "%DEPOT_TOOLS_DIR%.disable_auto_update" GOTO :EOF
23
[email protected]805133d2014-02-21 20:38:0124set GIT_URL=https://chromium.googlesource.com/chromium/tools/depot_tools.git
25
Dan Jacques13f258b2017-07-07 00:13:2726:: Will download git and python.
[email protected]83f47672014-03-19 19:22:0827call "%DEPOT_TOOLS_DIR%bootstrap\win\win_tools.bat"
[email protected]805133d2014-02-21 20:38:0128if errorlevel 1 goto :EOF
29:: Now clear errorlevel so it can be set by other programs later.
30set errorlevel=
31
[email protected]805133d2014-02-21 20:38:0132:: Shall skip automatic update?
33IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :EOF
34
Dan Jacques13f258b2017-07-07 00:13:2735:: We need .\.git\. to be able to sync.
[email protected]805133d2014-02-21 20:38:0136IF EXIST "%DEPOT_TOOLS_DIR%.git\." GOTO :GIT_UPDATE
37echo Error updating depot_tools, no revision tool found.
38goto :EOF
39
40
[email protected]805133d2014-02-21 20:38:0141:GIT_UPDATE
42cd /d "%DEPOT_TOOLS_DIR%."
43call git config remote.origin.fetch > NUL
[email protected]805133d2014-02-21 20:38:0144for /F %%x in ('git config --get remote.origin.url') DO (
45 IF not "%%x" == "%GIT_URL%" (
46 echo Your depot_tools checkout is configured to fetch from an obsolete URL
47 choice /N /T 60 /D N /M "Would you like to update it? [y/N]: "
48 IF not errorlevel 2 (
49 call git config remote.origin.url "%GIT_URL%"
50 )
51 )
52)
53call git fetch -q origin > NUL
54call git rebase -q origin/master > NUL
Dan Jacques5aeeb722017-07-28 13:22:2555if errorlevel 1 (
56 echo Failed to update depot_tools.
57 goto :EOF
58)
59
60:: Sync CIPD and CIPD client tools.
61call "%~dp0\cipd_bin_setup.bat"