aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/release/release.sh
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2017-01-10 14:23:10 +0000
committerGravatar Marcel Hlopko <hlopko@google.com>2017-01-10 14:32:33 +0000
commit353ce4701a3a737b6acb379b1baf9466ba66dd71 (patch)
tree91a407d47443911edae0fb9bd6ac0cb17c03da0f /scripts/release/release.sh
parent8e95f0cba344630dec216f32f9fc0577ae4e66de (diff)
Release scripts: add a git note with the cherrypick origin
If the patch-id differ because of merge conflict or subtle adjacent change, the cherrypick origin was missing, resulting in non existent cherrypick lines in the changelog. If the cherrypicks are done by the script, adds the cherrypick origin to a git note and use that origin when generating the release note. Also fallback to the commit hash of the resulting commit if the cherrypick origin cannot be found. Fixes #2272. -- Change-Id: I311bbe777ea82be05f9fba0a658bab075ed1bd97 Reviewed-on: https://cr.bazel.build/8042 PiperOrigin-RevId: 144075867 MOS_MIGRATED_REVID=144075867
Diffstat (limited to 'scripts/release/release.sh')
-rwxr-xr-xscripts/release/release.sh21
1 files changed, 15 insertions, 6 deletions
diff --git a/scripts/release/release.sh b/scripts/release/release.sh
index 3233393325..b8fb8474c0 100755
--- a/scripts/release/release.sh
+++ b/scripts/release/release.sh
@@ -125,6 +125,9 @@ function apply_cherry_picks() {
return 1
fi
}
+ # Add the origin of the cherry-pick in case the patch-id diverge and we cannot
+ # find the original commit.
+ git notes --ref=cherrypick add -f -m "$i"
done
return 0
}
@@ -233,8 +236,6 @@ function setup_git_notes() {
if [ -n "${last_release}" ]; then
# Compute the previous release notes
local last_baseline="$(get_release_baseline "${last_release}")"
- local last_cherrypicks="$(get_cherrypicks "${last_release}" \
- "${last_baseline}")"
git checkout -q "${last_release}"
local last_relnotes="$(create_release_notes "${tmpfile}")"
git checkout -q "${branch_name}"
@@ -258,15 +259,23 @@ function setup_git_notes() {
trap - EXIT
}
+# Force push a ref $2 to repo $1 if exists
+function push_if_exists() {
+ if git show-ref -q "${2}"; then
+ git push -f "${1}" "+${2}"
+ fi
+}
+
# Push the release branch to the release repositories so a release
# candidate can be created.
function push_release_candidate() {
local branch="$(get_release_branch)"
for repo in ${RELEASE_REPOSITORIES}; do
- git push -f ${repo} +${branch}
- git push -f ${repo} +refs/notes/release
- git push -f ${repo} +refs/notes/release-candidate
- git push -f ${repo} +refs/notes/release-notes
+ push_if_exists "${repo}" "${branch}"
+ push_if_exists "${repo}" "refs/notes/release"
+ push_if_exists "${repo}" "refs/notes/release-candidates"
+ push_if_exists "${repo}" "refs/notes/release-notes"
+ push_if_exists "${repo}" "refs/notes/cherrypick"
done
}