Merge "import a version of list_unreleased_changes.sh"
This commit is contained in:
commit
bd125c895d
23
README.rst
23
README.rst
|
@ -548,3 +548,26 @@ changes, and push the patch to gerrit.
|
|||
::
|
||||
|
||||
tox -e venv -- propose-final-releases newton ocata
|
||||
|
||||
tools/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.
|
||||
|
||||
::
|
||||
|
||||
./tools/list_unreleased_changes.sh master openstack/oslo.config
|
||||
|
||||
Print the list of changes in ``openstack/oslo.config`` along the
|
||||
master branch.
|
||||
|
||||
::
|
||||
|
||||
./tools/list_unreleased_changes.sh stable/kilo $(list-deliverables --repos --team Oslo)
|
||||
|
||||
Print the list of changes in the ``stable/kilo`` branch of all Oslo
|
||||
libraries.
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Shared functions for shell scripts
|
||||
#
|
||||
|
||||
# Make sure custom grep options don't get in the way
|
||||
unset GREP_OPTIONS
|
||||
|
||||
|
||||
function lp_project_to_repo {
|
||||
typeset proj="$1"
|
||||
|
||||
if [[ $proj == python-*client* ]]; then
|
||||
echo $proj
|
||||
elif [[ $proj == glance-store ]]; then
|
||||
echo glance_store
|
||||
elif [[ $proj == django-openstack-auth ]]; then
|
||||
echo django_openstack_auth
|
||||
else
|
||||
# Some of the repository names don't match the launchpad names, e.g.
|
||||
# python-stevedore and python-cliff.
|
||||
echo $proj | sed -e 's|^python-||'
|
||||
fi
|
||||
}
|
||||
|
||||
function title {
|
||||
echo
|
||||
if [ -t 1 ]; then
|
||||
echo "$(tput bold)$(tput setaf 1)[ $1 ]$(tput sgr0)"
|
||||
else
|
||||
echo "[ $1 ]"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function _cleanup_tmp {
|
||||
rm -rf $MYTMPDIR
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
function setup_temp_space {
|
||||
MYTMPDIR=`mktemp -d _tmp-${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)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get_last_tag {
|
||||
# Print the most recent tag for a ref. If no ref is specified, the
|
||||
# currently checked out branch is examined.
|
||||
local ref="$1"
|
||||
if ! git describe --abbrev=0 --first-parent ${ref} >/dev/null 2>&1; then
|
||||
echo ""
|
||||
else
|
||||
git describe --abbrev=0 --first-parent ${ref}
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function update_gitreview {
|
||||
typeset branch="$1"
|
||||
|
||||
title "Updating .gitreview"
|
||||
git checkout $branch
|
||||
# Remove a trailing newline, if present, to ensure consistent
|
||||
# formatting when we add the defaultbranch line next.
|
||||
typeset grcontents="$(echo -n "$(cat .gitreview | grep -v defaultbranch)")
|
||||
defaultbranch=$branch"
|
||||
echo "$grcontents" > .gitreview
|
||||
git add .gitreview
|
||||
git commit -m "Update .gitreview for $branch"
|
||||
git show
|
||||
local shortbranch=$(basename $branch)
|
||||
git review -t "create-${shortbranch}"
|
||||
}
|
||||
|
||||
|
||||
function update_upper_constraints {
|
||||
typeset branch="$1"
|
||||
typeset uc_server='git.openstack.org'
|
||||
typeset uc_path='cgit/openstack/requirements/plain/upper-constraints.txt'
|
||||
typeset uc_url="https://${uc_server}/${uc_path}?h=${branch}"
|
||||
|
||||
title "Updating tox.ini for upper-constraints"
|
||||
git checkout $branch
|
||||
sed -i~ -e "s,-c.*{\(env:UPPER_CONSTRAINTS_FILE\)[^ ]*},-c{\1:$uc_url}," tox.ini
|
||||
if ! git diff --exit-code >/dev/null 2>&1 ; then
|
||||
git add tox.ini
|
||||
git commit -m "Update UPPER_CONSTRAINTS_FILE for $branch"
|
||||
git show
|
||||
local shortbranch=$(basename $branch)
|
||||
git review -t "create-${shortbranch}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function clone_repo {
|
||||
typeset repo="$1"
|
||||
typeset branch="$2"
|
||||
if [ -z "$branch" ]; then
|
||||
branch="master"
|
||||
fi
|
||||
output=$({ zuul-cloner --branch "$branch" git://git.openstack.org $repo \
|
||||
&& (cd $repo && git review -s && git remote -v update \
|
||||
&& git fetch -v --tags); } 2>&1)
|
||||
_retval=$?
|
||||
if [ $_retval -ne 0 ] ; then
|
||||
echo "$output"
|
||||
fi
|
||||
|
||||
return $_retval
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
#!/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
|
||||
|
||||
if [[ $# -lt 2 ]]; then
|
||||
echo "Usage: $(basename $0) <branch> <repo> [<repo>...]"
|
||||
echo "repo should be e.g. openstack/glance"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
branch="$1"
|
||||
shift
|
||||
repos="$@"
|
||||
|
||||
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
BASEDIR=$(dirname $TOOLSDIR)
|
||||
source $TOOLSDIR/functions
|
||||
|
||||
if [[ -z "$VIRTUAL_ENV" ]]; then
|
||||
if [[ ! -d $BASEDIR/.tox/venv ]]; then
|
||||
(cd $BASEDIR && tox -e venv --notest)
|
||||
fi
|
||||
source $BASEDIR/.tox/venv/bin/activate
|
||||
fi
|
||||
|
||||
# Make sure no pager is configured so the output is not blocked
|
||||
export PAGER=
|
||||
|
||||
setup_temp_space 'list-unreleased'
|
||||
|
||||
function list_changes {
|
||||
title "Unreleased changes in $repo ($branch)"
|
||||
clone_repo $repo $branch
|
||||
if [[ $? -ne 0 ]]; then
|
||||
return 1
|
||||
fi
|
||||
cd $repo
|
||||
prev_tag=$(get_last_tag)
|
||||
if [ -z "$prev_tag" ]; then
|
||||
echo "$repo has not yet been released"
|
||||
else
|
||||
echo
|
||||
local end_sha=$(git log -n 1 --pretty=tformat:%h)
|
||||
echo "Changes between $prev_tag and $end_sha"
|
||||
echo
|
||||
git log --no-color --no-merges --format='%h %ci %s' --graph ${prev_tag}..${end_sha}
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
# Show the unreleased changes for each repository.
|
||||
for repo in $repos; do
|
||||
cd $MYTMPDIR
|
||||
echo
|
||||
list_changes "$repo"
|
||||
done
|
Loading…
Reference in New Issue