update_depot_tools: Pull changes first before updating tools on Win.

Update git checkout before updating the tools.
If the scripts to update the tools are broken in the current revision,
this will allow us to get a new, hopefully working, revision instead of
leaving us stuck on a broken one.

We already do this for Linux.

Change-Id: I31856ebbd659d5360ad705dc39e5856b4140a19f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2208625
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
changes/25/2208625/6
Edward Lesmes 5 years ago committed by LUCI CQ
parent c9eb1c3712
commit 942c97d626

@ -19,26 +19,25 @@ IF "%~nx0"=="update_depot_tools.bat" (
set DEPOT_TOOLS_DIR=%~1
SHIFT
:: Shall skip automatic update?
IF EXIST "%DEPOT_TOOLS_DIR%.disable_auto_update" GOTO :EOF
IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :EOF
set GIT_URL=https://chromium.googlesource.com/chromium/tools/depot_tools.git
:: Will download git and python.
:: Download git for the first time if it's not present.
call git --version > nul 2>&1
if %errorlevel% == 0 goto :GIT_UPDATE
call "%DEPOT_TOOLS_DIR%bootstrap\win_tools.bat"
if errorlevel 1 goto :EOF
if errorlevel 1 (
echo Error updating depot_tools, no revision tool found.
goto :EOF
)
:GIT_UPDATE
:: Now clear errorlevel so it can be set by other programs later.
set errorlevel=
:: Shall skip automatic update?
IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :EOF
:: We need .\.git\. to be able to sync.
IF EXIST "%DEPOT_TOOLS_DIR%.git\." GOTO :GIT_UPDATE
echo Error updating depot_tools, no revision tool found.
goto :EOF
:GIT_UPDATE
cd /d "%DEPOT_TOOLS_DIR%."
call git config remote.origin.fetch > NUL
for /F %%x in ('git config --get remote.origin.url') DO (
@ -59,3 +58,6 @@ if errorlevel 1 (
:: Sync CIPD and CIPD client tools.
call "%~dp0\cipd_bin_setup.bat"
:: Update git and python
call "%DEPOT_TOOLS_DIR%bootstrap\win_tools.bat"

Loading…
Cancel
Save