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
diff --git a/Cronet/tools/import/import_cronet.sh b/Cronet/tools/import/import_cronet.sh
index fed08f0..eb82551 100755
--- a/Cronet/tools/import/import_cronet.sh
+++ b/Cronet/tools/import/import_cronet.sh
@@ -34,6 +34,21 @@
}
#######################################
+# 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:
# ANDROID_BUILD_TOP
@@ -80,5 +95,6 @@
usage
fi
+setup_upstream_import_branch
do_run_copybara "${new_rev}" "${last_rev}" "${force}"