From 942c97d6260f4b9f70e358bbd5c6bb55750123da Mon Sep 17 00:00:00 2001 From: Edward Lesmes Date: Thu, 21 May 2020 17:38:40 +0000 Subject: [PATCH] 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 Commit-Queue: Edward Lesmes --- update_depot_tools.bat | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/update_depot_tools.bat b/update_depot_tools.bat index 97b18f4d1..4311f20ee 100644 --- a/update_depot_tools.bat +++ b/update_depot_tools.bat @@ -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"