aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xscripts/release/release.sh31
-rwxr-xr-xscripts/release/release_test.sh18
2 files changed, 39 insertions, 10 deletions
diff --git a/scripts/release/release.sh b/scripts/release/release.sh
index 76587e9043..b9a0f4bcbd 100755
--- a/scripts/release/release.sh
+++ b/scripts/release/release.sh
@@ -44,6 +44,14 @@ RELEASE_NOTE_MESSAGE='# Editing release notes
# empty line at the start and at the end.
'
+# Fetch everything from remote repositories to avoid conflicts
+function fetch() {
+ for i in ${RELEASE_REPOSITORIES}; do
+ git fetch $i &>/dev/null || true
+ git fetch $i refs/notes/*:refs/notes/* &>/dev/null || true
+ done
+}
+
# Set the release name $1 (and eventually the candidate number $2).
function set_release_name() {
git notes --ref=release remove 2>/dev/null || true
@@ -156,6 +164,11 @@ function apply_cherry_picks() {
# Execute the create command:
# Create a new release named "$1" with "$2" as the baseline commit.
function create_release() {
+ local force_rc=
+ if [[ "$1" =~ ^--force_rc=([0-9]*)$ ]]; then
+ force_rc=${BASH_REMATCH[1]}
+ shift 1
+ fi
local release_name="$1"
local baseline="$2"
shift 2
@@ -166,10 +179,15 @@ function create_release() {
local tmpfile2=$(mktemp ${TMPDIR:-/tmp}/relnotes-XXXXXXXX)
trap 'rm -f ${tmpfile} ${tmpfile2}' EXIT
+ fetch
# Get the rc number (1 by default)
local rc=1
- if [ -n "$(git branch --list --column ${branch_name})" ]; then
- rc=$(($(get_release_candidate "${branch_name}")+1))
+ if [ -z "${force_rc}" ]; then
+ if [ -n "$(git branch --list --column ${branch_name})" ]; then
+ rc=$(($(get_release_candidate "${branch_name}")+1))
+ fi
+ else
+ rc=${force_rc}
fi
# Save the changelog so we compute the relnotes against HEAD.
@@ -286,9 +304,12 @@ function usage() {
cat >&2 <<EOF
Usage: $1 command [arguments]
Available commands are:
- - create RELEASE_NAME BASELINE [COMMIT1 ... COMMITN]: creates a new
- release branch for release named RELEASE_NAME, cutting it at
- the commit BASELINE and cherry-picking COMMIT1 ... COMMITN.
+ - create [--force_rc=RC] RELEASE_NAME BASELINE [COMMIT1 ... COMMITN]:
+ creates a new release branch for release named RELEASE_NAME,
+ cutting it at the commit BASELINE and cherry-picking
+ COMMIT1 ... COMMITN. The release candidate number will be
+ computed from existing release branch unless --force_rc is
+ specified.
- push: push the current release branch to release repositories.
- release: do the actual release of the current release branch.
- abandon: abandon the current release branch.
diff --git a/scripts/release/release_test.sh b/scripts/release/release_test.sh
index aa4eb33d48..3b1d87004a 100755
--- a/scripts/release/release_test.sh
+++ b/scripts/release/release_test.sh
@@ -50,13 +50,19 @@ EOF
}
function create() {
+ local name="$1"
+ local commit="$2"
+ if [[ "$1" =~ ^--force_rc=([0-9]*)$ ]]; then
+ name="$2"
+ commit="$3"
+ fi
local old_branch=$(git_get_branch)
${RELEASE_SCRIPT} create $@ &> $TEST_log \
- || fail "Failed to cut release $1 at commit $2"
+ || fail "Failed to cut release $name at commit $commit"
local new_branch=$(git_get_branch)
assert_equals "$old_branch" "$new_branch"
- assert_contains "Created $1.* on branch release-$1." $TEST_log
- git show -s --pretty=format:%B "release-$1" >$TEST_log
+ assert_contains "Created $name.* on branch release-$name." $TEST_log
+ git show -s --pretty=format:%B "release-$name" >$TEST_log
}
function push() {
@@ -206,6 +212,7 @@ Cherry picks:
'
assert_equals "${header}Test replacement" "$(cat ${TEST_log})"
+ assert_equals 1 "$(get_release_candidate release-v1)"
push v1
# Test creating a second candidate
@@ -226,7 +233,7 @@ Cherry picks:
- Attribute error messages related to Android resources are easier
to understand now.'
assert_equals "${header}${RELNOTES}" "$(cat ${TEST_log})"
- assert_equals 2 "$(get_release_candidate)"
+ assert_equals 2 "$(get_release_candidate release-v1)"
# Push the release
push v1
@@ -239,9 +246,10 @@ Cherry picks:
echo 'Dummy release' >\$1
EOF
# Create release
- create v2 2464526
+ create --force_rc=2 v2 2464526
expect_log "Release v2"
expect_log "Baseline: 2464526"
+ assert_equals 2 "$(get_release_candidate release-v2)"
# Abandon it
abandon v2
# Add a commit hook to test if it is ignored