From 94e04f960c7c2a03ac8847a08b69d934b37aa6f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Mon, 12 Jul 2010 09:39:11 +0200 Subject: [PATCH] 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. --- sunrise-commit | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/sunrise-commit b/sunrise-commit index 7dd596b..f8f3209 100755 --- a/sunrise-commit +++ b/sunrise-commit @@ -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; *Gentoo Bug \([0-9]*\) - \(.*\);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}" ;;