diff options
author | Alex Tarkovsky <alextarkovsky@gmail.org> | 2006-06-30 15:11:00 +0000 |
---|---|---|
committer | Alex Tarkovsky <alextarkovsky@gmail.org> | 2006-06-30 15:11:00 +0000 |
commit | 62e4a32cca232bf764d5265967741efb9ce71800 (patch) | |
tree | 7622cadf0035aa4d5ad3f72e67545b13364deb9f /scripts | |
parent | net-analyzer/wireshark will go into portage... (diff) | |
download | sunrise-62e4a32cca232bf764d5265967741efb9ce71800.tar.gz sunrise-62e4a32cca232bf764d5265967741efb9ce71800.tar.bz2 sunrise-62e4a32cca232bf764d5265967741efb9ce71800.zip |
scripts/svncommit.sh: Obsolete, removing. scripts/sunrise-commit: Automatically prefixes commit message with categoryname/pkgname if an ebuild is among the committed files, otherwise prefixes with dirname/filename. Code readability improvements.
svn path=/sunrise/; revision=394
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/sunrise-commit | 99 |
1 files changed, 61 insertions, 38 deletions
diff --git a/scripts/sunrise-commit b/scripts/sunrise-commit index f2f432caf..aa27510b0 100755 --- a/scripts/sunrise-commit +++ b/scripts/sunrise-commit @@ -1,20 +1,35 @@ #!/bin/bash +# sunrise-commit - Automates the Gentoo Sunrise Overlay commit process +# Released into the public domain # $Id$ source /sbin/functions.sh +BLUE=$BRACKET BOLD=$'\e[0;01m' -GREEN=$'\e[32m' - -changelog=0 -disable_repoman=0 -force=0 -noupdate=0 -quiet=0 -verbose=0 +DARKGREEN=$'\e[32m' +GREEN=$GOOD +LIGHTBLUE=$HILITE +MSG_NEW_EBUILD="New Ebuild" +MSG_PATCH="Patch" +MSG_REVISION_BUMP="Revision Bump" +MSG_VERSION_BUMP="Version Bump" +RED=$BAD +YELLOW=$WARN + +commit_category=$(echo `pwd` | awk -F/ '{ print $(NF-1) }') +commit_message="moo" +commit_package=$(echo `pwd` | awk -F/ '{ print $NF }') +commit_status="$(echo `svn status`)" +opt_changelog=0 +opt_disable_repoman=0 +opt_force=0 +opt_noupdate=0 +opt_quiet=0 +opt_verbose=0 changelog_append() { - if [[ "$changelog" == "1" ]] ; then + if [[ "$opt_changelog" == "1" ]] ; then ebegin "Appending/creating ChangeLog" echangelog "$1" eend $? @@ -24,7 +39,7 @@ changelog_append() { } create_digests() { - if [[ "$force" == "0" ]] ; then + if [[ "$opt_force" == "0" ]] ; then if [[ ! $(find *.ebuild -maxdepth 0) ]] ; then echo "!!! Error: No ebuilds found in current directory. Use -f to force commit." exit 1 @@ -37,8 +52,17 @@ create_digests() { fi } +format_message() { + commit_status="$(echo `svn status`)" + if [[ "$commit_status" =~ '\.ebuild' ]] ; then + commit_message="${commit_category}/${commit_package}: $*" + else + commit_message="${commit_package}/$(echo $commit_status | awk '{ print $2 }'): $*" + fi +} + repoman_check() { - if [[ "$disable_repoman" == "0" ]] ; then + if [[ "$opt_disable_repoman" == "0" ]] ; then ebegin "Running repoman" PORTDIR_OVERLAY=$(dirname $(dirname $(pwd))) export PORTDIR_OVERLAY @@ -51,7 +75,7 @@ repoman_check() { svn_add() { ebegin "Adding local changes to working copy" - if [[ "$verbose" == "1" ]] ; then + if [[ "$opt_verbose" == "1" ]] ; then svn add * else svn add -q * @@ -61,13 +85,17 @@ svn_add() { svn_commit() { echo - echo "${GREEN}The following local changes will be committed to the repository:${NORMAL}" + echo "${DARKGREEN}The following local changes will be committed to the repository:${NORMAL}" echo svn status + echo + echo "${DARKGREEN}The following commit message will be used:${NORMAL}" + echo + echo "$*" - if [[ "$quiet" == "0" ]] ; then + if [[ "$opt_quiet" == "0" ]] ; then echo - echo -n "${BOLD}Commit changes?${NORMAL} [${GOOD}Yes${NORMAL}/${BAD}No${NORMAL}] " + echo -n "${BOLD}Commit changes?${NORMAL} [${GREEN}Yes${NORMAL}/${RED}No${NORMAL}] " read choice echo @@ -88,9 +116,9 @@ svn_commit() { } svn_up() { - if [[ "$noupdate" == "0" ]] ; then + if [[ "$opt_noupdate" == "0" ]] ; then ebegin "Updating working copy to latest version from repository" - if [[ "$verbose" == "1" ]] ; then + if [[ "$opt_verbose" == "1" ]] ; then svn update else svn update -q @@ -103,10 +131,10 @@ svn_up() { usage() { cat << EOF -${BOLD}Usage:${NORMAL} ${HILITE}sunrise-commit${NORMAL} [ ${GOOD}options${NORMAL} ] ${BRACKET}message${NORMAL} +${BOLD}Usage:${NORMAL} ${HILITE}sunrise-commit${NORMAL} [ ${GREEN}options${NORMAL} ] ${BLUE}message${NORMAL} -${GOOD}options${NORMAL} are: - ${BOLD}-c, --changelog${NORMAL} Create a ChangeLog entry using ${BRACKET}message${NORMAL} +${GREEN}options${NORMAL} are: + ${BOLD}-c, --changelog${NORMAL} Create a ChangeLog entry using ${BLUE}message${NORMAL} ${BOLD}-d, --disable-repoman${NORMAL} Skip repoman check ${BOLD}-f, --force${NORMAL} Commit even if no ebuilds are present ${BOLD}-h, --help${NORMAL} Show help @@ -114,15 +142,9 @@ ${GOOD}options${NORMAL} are: ${BOLD}-q, --quiet${NORMAL} Don't ask for confirmation ${BOLD}-v, --verbose${NORMAL} Show more detailed information during commit -${BRACKET}message${NORMAL} is: - Commit message describing changes made. ${BOLD}Please include the ebuild's name here.${NORMAL} - For ebuild updates the suggested message format is: - - "${WARN}categoryname${NORMAL}/${WARN}packagename${NORMAL}: ${WARN}List of changes${NORMAL}. Thanks to ${WARN}list of contributors${NORMAL}." - - For new ebuilds, prefix the above message with: - - "[New ebuild] Bug ${WARN}Gentoo bug #${NORMAL}, " +${BLUE}message${NORMAL} is: + Commit message describing changes and listing names/emails of anyone (other + than the commiter) who contributed. EOF exit ${1:-0} } @@ -137,30 +159,30 @@ while [[ $# > 0 ]] ; do echo "!!! export ECHANGELOG_USER=\"Your Name <your@mail.org>\"" exit 1 fi - changelog=1 + opt_changelog=1 shift ;; --disable-repoman|-d) - disable_repoman=1 + opt_disable_repoman=1 shift ;; --force|-f) - force=1 + opt_force=1 shift ;; --help|-h) usage ;; --noupdate|-n) - noupdate=1 + opt_noupdate=1 shift ;; --quiet|-q) - quiet=1 + opt_quiet=1 shift ;; --verbose|-v) - verbose=1 + opt_verbose=1 shift ;; -*) @@ -177,8 +199,8 @@ if [[ -z "$*" ]] ; then exit 1 fi -if [[ -z "$(echo `svn status`)" ]] ; then - ewarn "No changes found in current directory." +if [[ -z "$commit_status" ]] ; then + ewarn "No changes found in current directory tree." exit 1 fi @@ -187,4 +209,5 @@ create_digests || exit $? changelog_append "$1" || exit $? svn_add || exit $? #repoman_check || exit $? -svn_commit "$*" || exit $? +format_message "$*" +svn_commit "$commit_message" || exit $? |