# 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
-if ! [ -e sunrise ] || ! [ -e reviewed ]; then
- eerror "You need to have sunrise and reviewed subdirs"
- exit
-fi
-
-svn_up() {
- if [[ "$opt_noupdate" == "0" ]] ; then
- ebegin "Updating working copy to latest version from repository"
-
- if [[ "$opt_verbose" == "1" ]] ; then
- svn update || set $?
- else
- svn update -q || set $?
- fi
-
- eend ${1:-0}
-
- 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 ${1:-0}
-}
+DIFF="${DIFF:-diff}"
+DIFF_OPTS="${DIFF_OPTS:--Nur}"
repoman_check() {
if [[ "$opt_norepoman" == "0" ]] ; then
exit ${1:-0}
}
-[[ -z "$1" ]] && usage 1
-
while [[ $# > 0 ]] ; do
case "$1" in
--help|-h)
shift ;;
-*)
- echo "!!! Error: Unknown option ${1}. See: sunrise-commit -h"
+ echo "!!! Error: Unknown option ${1}. See: $0 -h"
exit 1 ;;
*)
esac
done
-if [[ -z "$*" ]] ; then
- echo "!!! Error: You must supply a revision. See: $0 -h"
- exit 1
+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
-svn_up || exit $?
-
-sunrise_revision=$*
-reviewed_revision=$(svn log reviewed 2>/dev/null | grep "Reviewed up to revision " -m 1 | sed "s:Reviewed up to revision ::")
+egencache --ignore-default-opts --portdir-overlay=. \
+ --repo=sunrise --update-use-local-desc || exit $?
-if [ $reviewed_revision -gt $sunrise_revision ]; then
- eerror "a newer revision is already reviewed"
- 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
-(
-cd sunrise
+ebegin "Updating working copy to latest version from repository"
+git pull --rebase
+
+(
repoman_check || exit $?
ebegin "Running portdupe"
scripts/portdupe
eend $?
-cd ..
if [[ "$opt_quiet" == "0" ]] ; then
- 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
esac
fi
-ebegin "Merging in changes..."
+ebegin "Pushing changes..."
if [[ "$opt_verbose" == "1" ]] ; then
- svn merge sunrise@$reviewed_revision sunrise@$sunrise_revision reviewed || set $?
+ git push -v origin master
+ git push -v reviewed master
else
- svn merge sunrise@$reviewed_revision sunrise@$sunrise_revision reviewed -q || set $?
+ git push origin master
+ git push reviewed master
fi
-eend ${1:-0}
-
-ebegin "Committing working copy to repository"
-svn commit -m "$commit_message"
-eend $?
+eend ${?}