]> Pileus Git - ~andy/sunrise/blobdiff - scripts/review
media-gfx/ktikz: Properly fix qt deps
[~andy/sunrise] / scripts / review
index 1a017c56b842b0f67c8cfc1d5fca5f5b09d61fcb..a716464b1fc4927823ecbdd48be51e95e4178638 100755 (executable)
@@ -2,39 +2,22 @@
 # review - Move a certain revision from sunrise/ to reviewed/
 # Released into the public domain
 
-source /sbin/functions.sh
+source /etc/init.d/functions.sh
 
-BLUE=$BRACKET
+BLUE=$'\033[34;01m'
 BOLD=$'\e[0;01m'
 DARKGREEN=$'\e[32m'
-GREEN=$GOOD
+GREEN=$'\e[32;01m'
 LIGHTBLUE=$HILITE
-RED=$BAD
-YELLOW=$WARN
+RED=$'\033[31;01m'
+YELLOW=$'\033[33;01m'
 opt_norepoman=0
 opt_noupdate=0
 opt_quiet=0
 opt_verbose=0
 
-svn_up() {
-       if [[ "$opt_noupdate" == "0" ]] ; then
-               svn update $*
-
-               local conflict_files=$(svn status | sed -rn 's/^C.+ ([^ ]+)$/\1/p')
-               if [[ -n "$conflict_files" ]] ; then
-                       echo "!!! Error: Some local files have changes that conflict with the latest"
-                       echo "!!! revisions in the repository. Please contact the previous committer(s) to"
-                       echo "!!! resolve the conflicts manually before running sunrise-commit again:"
-                       for filename in $conflict_files ; do
-                               echo "!!!"
-                               echo "!!!        file: ${filename}"
-                               echo "!!!   committer: $(svn info ${filename} | sed -rn 's/Last Changed Author\: (.*)$/\1/p')"
-                       done
-                       exit 1
-               fi
-       fi
-       return 0
-}
+DIFF="${DIFF:-diff}"
+DIFF_OPTS="${DIFF_OPTS:--Nur}"
 
 repoman_check() {
        if [[ "$opt_norepoman" == "0" ]] ; then
@@ -82,7 +65,7 @@ while [[ $# > 0 ]] ; do
                        shift ;;
 
                -*)
-                       echo "!!! Error: Unknown option ${1}. See: sunrise-commit -h"
+                       echo "!!! Error: Unknown option ${1}. See: $0 -h"
                        exit 1 ;;
 
                *)
@@ -90,52 +73,54 @@ while [[ $# > 0 ]] ; do
        esac
 done
 
-if [[ -z "$*" ]] ; then
-       ebegin "Updating working copy to latest version from repository"
-       update=$(svn_up)
-       if [[ "$opt_verbose" == "1" ]] ; then
-               echo $update
-       fi
-       update=$(echo $update | tail -n 1)
-       update=${update/At revision }
-       sunrise_revision=${update/.}
-       [ "$sunrise_revision" -lt "10" ] && exit 1
-       eend
-#elif [[ "$*" =~ "^[0-9]*$" ]]; then 
-#      echo "!!! Error: The revision must be an integer value $*"
-#      exit 1
-else
-       sunrise_revision=$*
-
-       ebegin "Updating working copy to latest version from repository"
-       svn_up -r $sunrise_revision || exit $?
-       eend
+LC_ALL="C" ls -d *-* > profiles/categories
+if [[ $(git diff profiles/categories) ]]; then
+       git diff profiles/categories | if [[ "$opt_quiet" == "0" ]] ; then less; else cat; fi
+       echo -n "${BOLD}Commit changes?${NORMAL} [${GREEN}Yes${NORMAL}/${RED}No${NORMAL}] "
+       read choice
+       echo
+       case "$choice" in
+               y*|Y*|"")
+                       git commit -m "Automatic update to categories" profiles/categories || exit 1
+                       ;;
+               *)
+                       echo "Quitting."
+                       echo
+                       exit ;;
+       esac
 fi
 
-if ! [ -e sunrise ] || ! [ -e reviewed ]; then
-       eerror "You need to have sunrise and reviewed subdirs"
-       exit
+egencache --ignore-default-opts --portdir-overlay=. \
+       --repo=sunrise --update-use-local-desc || exit $?
+
+if [[ $(git diff profiles/use.local.desc) ]]; then
+       git diff profiles/use.local.desc | if [[ "$opt_quiet" == "0" ]] ; then less; else cat; fi
+       echo -n "${BOLD}Commit changes?${NORMAL} [${GREEN}Yes${NORMAL}/${RED}No${NORMAL}] "
+       read choice
+       echo
+       case "$choice" in
+               y*|Y*|"")
+                       git commit -m "Automatic update to use.local.desc" profiles/use.local.desc || exit 1
+                       ;;
+               *)
+                       echo "Quitting."
+                       echo
+                       exit ;;
+       esac
 fi
 
-reviewed_revision=$(svn log reviewed 2>/dev/null | grep "Reviewed up to revision " -m 1 | sed "s:Reviewed up to revision ::")
+ebegin "Updating working copy to latest version from repository"
+git pull --rebase
 
-if [ $reviewed_revision -gt $sunrise_revision ]; then
-       eerror "a newer revision is already reviewed"
-       exit
-fi
 (
-cd sunrise
-
 repoman_check || exit $?
 
 ebegin "Running portdupe"
 scripts/portdupe
 eend $?
 
-cd ..
 if [[ "$opt_quiet" == "0" ]] ; then
-       which diffstat >/dev/null 2>&1 && diff -Nur reviewed sunrise --exclude=.svn | diffstat
-       diff -Nur reviewed sunrise --exclude=Manifest --exclude=.svn --exclude=metadata.xml --exclude=digest-*
+       git diff reviewed/master master
 fi
 ) | if [[ "$opt_quiet" == "0" ]] ; then less; else cat; fi
 
@@ -156,14 +141,12 @@ if [[ "$opt_quiet" == "0" ]] ; then
        esac
 fi
 
-ebegin "Merging in changes..."
+ebegin "Pushing changes..."
 if [[ "$opt_verbose" == "1" ]] ; then
-       svn merge sunrise@$reviewed_revision sunrise@$sunrise_revision reviewed
+       git push -v origin master
+       git push -v reviewed master
 else
-       svn merge sunrise@$reviewed_revision sunrise@$sunrise_revision reviewed -q
+       git push origin master
+       git push reviewed master
 fi
 eend ${?}
-
-ebegin "Committing working copy to repository"
-svn commit reviewed -m "Reviewed up to revision $sunrise_revision"
-eend $?