From 2ceab19fe7dafb7392a959f18c70a4517a34232d Mon Sep 17 00:00:00 2001 From: Patrick Rohr Date: Tue, 21 Feb 2023 13:12:43 -0800 Subject: [PATCH] cronet import: let script create upstream-import branch git branch will fail if the branch already exists which is exactly what we want. Test: run script Change-Id: I2e05b016d532d52b473d8cb5d99b831f25a39b5f --- Cronet/tools/import/import_cronet.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Cronet/tools/import/import_cronet.sh b/Cronet/tools/import/import_cronet.sh index fed08f018b..eb82551c41 100755 --- a/Cronet/tools/import/import_cronet.sh +++ b/Cronet/tools/import/import_cronet.sh @@ -33,6 +33,21 @@ EOF exit 1 } +####################################### +# Create upstream-import branch in external/cronet. +# Globals: +# ANDROID_BUILD_TOP +# Arguments: +# none +####################################### +setup_upstream_import_branch() { + local git_dir="${ANDROID_BUILD_TOP}/external/cronet" + local initial_empty_repo_sha="d1add53d6e90815f363c91d433735556ce79b0d2" + + # Suppress error message if branch already exists. + (cd "${git_dir}" && git branch upstream-import "${initial_empty_repo_sha}") 2>/dev/null +} + ####################################### # Runs the copybara import of Chromium # Globals: @@ -80,5 +95,6 @@ if [ -z "${new_rev}" ]; then usage fi +setup_upstream_import_branch do_run_copybara "${new_rev}" "${last_rev}" "${force}"