Describe bugs in ChangeLog entries, print VCS status.

Don't count ChangeLog edits to changes. Require the first ChangeLog
entry to contain a bug number for the new ebuild. Describe all bugs
appearing in the ChangeLog entry. Print out VCS status before starting
to commit.
This commit is contained in:
Michał Górny 2010-07-12 09:39:11 +02:00
parent a15315093e
commit 94e04f960c

View File

@ -78,11 +78,11 @@ check_for_changes() {
local output
if [ ${SC_VCS%-svn} = git ]; then
output="$(git diff-index --name-status --relative HEAD)"
output="$(git diff-index --name-only --relative HEAD)"
fi
sayv "${output}"
[ -n "${output}" ]
# We do not care about user mangling ChangeLog, we will reset it anyway.
echo "${output}" | grep -v ChangeLog >/dev/null
}
vcs_reset() {
@ -92,6 +92,12 @@ vcs_reset() {
fi
}
vcs_status() {
if [ ${SC_VCS%-svn} = git ]; then
git status -s .
fi
}
# Guess what!
main() {
local commitmsg
@ -125,13 +131,34 @@ main() {
# With native git repos, we do not do ChangeLogs by default...
# ...at least unless they're already there.
if [ ${SC_VCS} = git -a ! -f ChangeLog ]; then
if [ ${SC_VCS} != git -o -f ChangeLog ]; then
sayv 'Cleaning up the ChangeLog...'
vcs_reset ChangeLog
local bns
# Let's take a lucky guess bugnumbers consist of 4+ digits.
bns="$(echo "${commitmsg}" | grep -o -E '[0-9]{4,}')"
# Creating a new ChangeLog? Let's take a look at the commit message.
[ ! -f ChangeLog -a -z "${bns}" ] && die 'Please supply the bug number in the initial commit message!'
sayv '...and appending to it.'
echangelog "${commitmsg}"
req echangelog "${commitmsg}"
if [ -n "${bns}" ]; then
echo
local bn
for bn in ${bns}; do
wget -q http://bugs.gentoo.org/show_bug.cgi?id=12345 -O - \
| sed -e 's; *<title>Gentoo Bug \([0-9]*\) - \(.*\)</title>;Bug \1: \2;gp' -e d
done
echo
fi
fi
vcs_status
echo
sayv "Now, let's let repoman do its job..."
exec repoman commit -a -m "${SC_CP}: ${commitmsg}"
;;