Improve unreleased change report

Add a script to sort the version tags so that list_unreleased_changes.sh
does not pick up "eol" tags and other values that shouldn't be considered
when determining the most recent tag.

Start a script for printing standard format release notes for a
repository, given the version range. Use that script to expand the
information printed by list_unreleased_changes.sh.

Change-Id: Id091d697810ba7d65ae64fd2e52fd09cd78baf59
This commit is contained in:
Doug Hellmann 2014-11-21 10:49:26 -05:00
parent 7e77a8236b
commit 09620e8a22
3 changed files with 103 additions and 7 deletions

57
highest_semver.py Executable file
View File

@ -0,0 +1,57 @@
#!/usr/bin/env python
#
# 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.
"""Read a list of version tags from stdin and pick the one with the
highest semver value.
"""
from __future__ import print_function
import fileinput
import sys
def try_int(val):
try:
return int(val)
except ValueError:
return val
tags = []
for line in fileinput.input(sys.argv[1:]):
line = line.strip()
if not line:
continue
parts = line.split('.')
v = tuple(try_int(val) for val in parts)
if len(v) == 3:
v = v + ('zzz',) # artifically sort the value higher than alphas
# Ignore versions where the beginning doesn't look like a number,
# such as 'havana-eol'
if not isinstance(v[0], int):
continue
# Ignore date-based entries
if v[0] > 100:
continue
tags.append(v)
if tags:
# We only want to print something if we actually have any tags to
# pick from. Otherwise we probably have a library that has never
# been released, so there is no valid version.
version = max(tags)
if version[-1] == 'zzz':
version = version[:-1]
print('.'.join(str(t) for t in version))

View File

@ -14,7 +14,7 @@
#
# Provide a list of the unreleased changes in the oslo libraries.
bindir=$(dirname $0)
bindir=$(cd $(dirname $0) && pwd)
repodir=$(cd $bindir/../../.. && pwd)
# Make sure no pager is configured so the output is not blocked
@ -32,8 +32,8 @@ fi
# release.
function get_last_tag {
git for-each-ref --sort=taggerdate --format '%(refname)' refs/tags \
| tail -n 1 \
| sed -e 's|refs/tags/||'
| sed -e 's|refs/tags/||' \
| ${bindir}/highest_semver.py
}
# Show the unreleased changes for each library.
@ -52,9 +52,6 @@ do
then
echo "$lib has not yet been released"
else
range="${prev_tag}..HEAD"
echo "$lib $range"
echo
git log --oneline --no-merges $range
$bindir/release_notes.sh $lib $prev_tag HEAD
fi
done

42
release_notes.sh Executable file
View File

@ -0,0 +1,42 @@
#!/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.
#
# Generate a standard set of release notes for a repository.
#
# Usage: release_notes.sh <repo_name> starttag endrev
#
# Example: release_notes.sh ../openstack/oslo.config 1.4.0 HEAD
bindir=$(cd $(dirname $0) && pwd)
repodir=$(cd $bindir/../../.. && pwd)
lib=$1
start_rev=$2
end_rev=$3
range="${start_rev}..${end_rev}"
cd $repodir/$lib
echo "$lib $range"
echo
git log --no-color --oneline --no-merges $range
echo
echo " diffstat (except docs and test files):"
echo
git diff --stat --no-color $range | egrep -v '(/tests/|^ doc)'
echo
echo " Requirements updates:"
echo
git diff -U0 --no-color $range *requirements*.txt | sed -e 's/^/ /g'