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
This commit is contained in:
Patrick Rohr
2023-02-21 13:12:43 -08:00
parent 3817a942a1
commit 2ceab19fe7

View File

@@ -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}"