Add list_unreleased_changes.sh
Add a script to list the changes in a given branch of a set of repositories. Change-Id: I3ed3df4fb640f20d9d86eb0a9618fbb67a58be77
This commit is contained in:
parent
7b98e09cee
commit
7c17f7b886
|
@ -54,3 +54,4 @@ ChangeLog
|
|||
|
||||
# local temporary directory
|
||||
release-tag-*
|
||||
list-unreleased-*
|
||||
|
|
19
README.rst
19
README.rst
|
@ -176,6 +176,25 @@ Examples:
|
|||
is useful for examining the list of unreleased changes in a project
|
||||
to decide if a release is warranted and to pick a version number.
|
||||
|
||||
list_unreleased_changes.sh
|
||||
--------------------------
|
||||
|
||||
Given a branch and one or more repositories, produce a list of the
|
||||
changes in those repositories since their last tag on that
|
||||
branch. This is useful for deciding if a project needs to prepare a
|
||||
release, and for predicting what the next release version should be by
|
||||
looking at the commit logs.
|
||||
|
||||
./list_unreleased_changes.sh master openstack/oslo.config
|
||||
|
||||
Print the list of changes in ``openstack/oslo.config`` along the
|
||||
master branch.
|
||||
|
||||
./list_unreleased_changes.sh stable/kilo $(./list_repos_by_project.py --code-only Oslo)
|
||||
|
||||
Print the list of changes in the ``stable/kilo`` branch of all Oslo
|
||||
libraries.
|
||||
|
||||
make_library_stable_branch.sh
|
||||
-----------------------------
|
||||
|
||||
|
|
23
functions
23
functions
|
@ -14,3 +14,26 @@ function lp_project_to_repo {
|
|||
echo $proj | sed -e 's|python-||'
|
||||
fi
|
||||
}
|
||||
|
||||
function title {
|
||||
echo
|
||||
echo "$(tput bold)$(tput setaf 1)[ $1 ]$(tput sgr0)"
|
||||
}
|
||||
|
||||
|
||||
function _cleanup_tmp {
|
||||
title "Cleaning up"
|
||||
rm -rf $MYTMPDIR
|
||||
}
|
||||
|
||||
|
||||
function setup_temp_space {
|
||||
MYTMPDIR=`mktemp -d ${1}-XXX`
|
||||
mkdir -p "$MYTMPDIR"
|
||||
trap _cleanup_tmp EXIT
|
||||
cd "$MYTMPDIR"
|
||||
# NOTE(dhellmann): On some platforms mktemp returns a short name
|
||||
# instead of a full path, so expand the full path by looking at
|
||||
# where we ended up after the cd operation.
|
||||
MYTMPDIR="$(pwd)"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Provide a list of the unreleased changes in the given repositories
|
||||
|
||||
bindir=$(cd $(dirname $0) && pwd)
|
||||
branch="$1"
|
||||
shift
|
||||
repos="$@"
|
||||
|
||||
source $bindir/functions
|
||||
|
||||
# Make sure no pager is configured so the output is not blocked
|
||||
export PAGER=
|
||||
|
||||
function get_last_tag {
|
||||
# Use git log to show changes on this branch, and add --decorate
|
||||
# to include the tag names. Then use grep and sed to pull the tag
|
||||
# name out so that is all we pass to highest_semver.py.
|
||||
#
|
||||
# This assumes the local copy of the repo is on the branch from
|
||||
# which we would want to release.
|
||||
git log --decorate --oneline \
|
||||
| egrep '^[0-9a-f]+ \((HEAD, )?tag: ' \
|
||||
| sed -r 's/^.+tag: ([^ ]+)[,\)].+$/\1/g' \
|
||||
| ${bindir}/highest_semver.py
|
||||
|
||||
# Look at *all* tags, sorted by the date they were applied. This
|
||||
# sometimes predicts the wrong value, especially when we might be
|
||||
# releasing from a branch other than master.
|
||||
#
|
||||
# git for-each-ref --sort=taggerdate --format '%(refname)' refs/tags \
|
||||
# | sed -e 's|refs/tags/||' \
|
||||
# | ${bindir}/highest_semver.py
|
||||
}
|
||||
|
||||
setup_temp_space 'list-unreleased'
|
||||
|
||||
function list_changes {
|
||||
git clone -q git://git.openstack.org/$repo -b $branch
|
||||
if [[ $? -ne 0 ]]; then
|
||||
return 1
|
||||
fi
|
||||
cd $(basename $repo)
|
||||
prev_tag=$(get_last_tag)
|
||||
if [ -z "$prev_tag" ]; then
|
||||
echo "$repo has not yet been released"
|
||||
else
|
||||
echo
|
||||
$bindir/release_notes.py \
|
||||
--show-dates \
|
||||
--changes-only \
|
||||
. $prev_tag HEAD
|
||||
fi
|
||||
}
|
||||
|
||||
# Show the unreleased changes for each repository.
|
||||
for repo in $repos; do
|
||||
cd $MYTMPDIR
|
||||
echo
|
||||
title "$repo"
|
||||
list_changes "$repo"
|
||||
done
|
|
@ -43,24 +43,12 @@ PROJECT=$4
|
|||
|
||||
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
function title {
|
||||
echo
|
||||
echo "$(tput bold)$(tput setaf 1)[ $1 ]$(tput sgr0)"
|
||||
}
|
||||
|
||||
if [[ $VERSION == *a* ]]; then
|
||||
ALPHA_RELEASE=1
|
||||
TARGET="next-$SERIES"
|
||||
fi
|
||||
|
||||
MYTMPDIR=`mktemp -d release-tag-$PROJECT-XXX`
|
||||
function cleanup_tmp {
|
||||
title "Cleaning up"
|
||||
cd /tmp
|
||||
rm -rf $MYTMPDIR
|
||||
}
|
||||
trap cleanup_tmp EXIT
|
||||
cd $MYTMPDIR
|
||||
setup_temp_space release-tag-$PROJECT
|
||||
|
||||
REPO=$(lp_project_to_repo $PROJECT)
|
||||
|
||||
|
|
Loading…
Reference in New Issue