aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/release
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2016-12-20 07:41:59 +0000
committerGravatar Klaus Aehlig <aehlig@google.com>2016-12-20 09:41:07 +0000
commit55c97bcf9b99916a3fe59295be64c4aee860d823 (patch)
treef8ef267f8a1c0f86513aadf2d4bb1c30989bcdab /scripts/release
parentacbcbc2ff7dab2e68801c714e57475d6d57be8f2 (diff)
Release script: if master branch does not exist, fall back on origin/master
On ci.bazel.io local branch names are not set, so the release script was not finding information about the master branch. If the master ref does not exist, this change fall backs to looking at origin/master instead. Fixes #2263. To be cherry-picked for #2246. -- Change-Id: Ibe4f3533e529d79917233d89951f88cb58d14ce3 Reviewed-on: https://cr.bazel.build/8033 PiperOrigin-RevId: 142524954 MOS_MIGRATED_REVID=142524954
Diffstat (limited to 'scripts/release')
-rwxr-xr-xscripts/release/common.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/scripts/release/common.sh b/scripts/release/common.sh
index de3ccd0721..33b2c38440 100755
--- a/scripts/release/common.sh
+++ b/scripts/release/common.sh
@@ -128,10 +128,16 @@ function create_revision_information() {
done
}
+# Get the master commit
+# Some machine might not have a "master" branch, use "origin/master" in that case
+function get_master_ref() {
+ git rev-parse --verify master 2>/dev/null || git rev-parse --verify origin/master
+}
+
# Get the baseline of master.
# Args: $1: release branch, default to HEAD
function get_release_baseline() {
- git merge-base master "${1:-HEAD}"
+ git merge-base $(get_master_ref) "${1:-HEAD}"
}
# Get the list of cherry-picks since master
@@ -140,11 +146,12 @@ function get_release_baseline() {
# $2: baseline change, default to $(get_release_baseline $1)
function get_cherrypicks() {
local branch="${1:-HEAD}"
+ local master=$(get_master_ref)
local baseline="${2:-$(get_release_baseline "${branch}")}"
# List of changes since the baseline on the release branch
local changes="$(git_log_hash "${baseline}" "${branch}" --reverse)"
# List of changes since the baseline on the master branch, and their patch-id
- local master_changes="$(git_log_hash "${baseline}" master | xargs git show | git patch-id)"
+ local master_changes="$(git_log_hash "${baseline}" "${master}" | xargs git show | git patch-id)"
# Now for each changes on the release branch
for i in ${changes}; do
# Find the change with the same patch-id on the master branch