2 # review - Move a certain revision from sunrise/ to reviewed/
3 # Released into the public domain
5 source /sbin/functions.sh
20 if [[ "$opt_noupdate" == "0" ]] ; then
21 ebegin "Updating working copy to latest version from repository"
23 if [[ "$opt_verbose" == "1" ]] ; then
26 svn update -q || set $?
31 local conflict_files=$(svn status | sed -rn 's/^C.+ ([^ ]+)$/\1/p')
32 if [[ -n "$conflict_files" ]] ; then
33 echo "!!! Error: Some local files have changes that conflict with the latest"
34 echo "!!! revisions in the repository. Please contact the previous committer(s) to"
35 echo "!!! resolve the conflicts manually before running sunrise-commit again:"
36 for filename in $conflict_files ; do
38 echo "!!! file: ${filename}"
39 echo "!!! committer: $(svn info ${filename} | sed -rn 's/Last Changed Author\: (.*)$/\1/p')"
48 if [[ "$opt_norepoman" == "0" ]] ; then
49 ebegin "Running repoman"
50 export PORTDIR_OVERLAY="$(pwd)"
59 ${BOLD}Usage:${NORMAL} ${LIGHTBLUE}$0${NORMAL} [ ${GREEN}options${NORMAL} ] ${BLUE}revision${NORMAL}
61 ${GREEN}options${NORMAL}:
62 ${BOLD}--help, -h${NORMAL} Show help
63 ${BOLD}--norepoman, -p${NORMAL} Skip repoman check
64 ${BOLD}--noupdate, -d${NORMAL} Don't update from repository before committing
65 ${BOLD}--quiet, -q${NORMAL} Don't ask for confirmation
66 ${BOLD}--verbose, -v${NORMAL} Show detailed information during commit
71 [[ -z "$1" ]] && usage 1
73 while [[ $# > 0 ]] ; do
95 echo "!!! Error: Unknown option ${1}. See: sunrise-commit -h"
103 if [[ -z "$*" ]] ; then
104 echo "!!! Error: You must supply a revision. See: $0 -h"
110 if ! [ -e sunrise ] || ! [ -e reviewed ]; then
111 eerror "You need to have sunrise and reviewed subdirs"
115 if svn st | grep -q sunrise/ 2>/dev/null; then
116 eerror "Please commit your local changes to sunrise before running this script"
121 reviewed_revision=$(svn log reviewed 2>/dev/null | grep "Reviewed up to revision " -m 1 | sed "s:Reviewed up to revision ::")
123 if [ $reviewed_revision -gt $sunrise_revision ]; then
124 eerror "a newer revision is already reviewed"
130 repoman_check || exit $?
132 ebegin "Running portdupe"
137 if [[ "$opt_quiet" == "0" ]] ; then
138 diff -Nur reviewed sunrise --exclude=Manifest --exclude=.svn --exclude=metadata.xml --exclude=digest-*
140 ) | if [[ "$opt_quiet" == "0" ]] ; then less; else cat; fi
142 if [[ "$opt_quiet" == "0" ]] ; then
144 echo -n "${BOLD}Commit changes?${NORMAL} [${GREEN}Yes${NORMAL}/${RED}No${NORMAL}] "
159 ebegin "Merging in changes..."
160 if [[ "$opt_verbose" == "1" ]] ; then
161 svn merge sunrise@$reviewed_revision sunrise@$sunrise_revision reviewed || set $?
163 svn merge sunrise@$reviewed_revision sunrise@$sunrise_revision reviewed -q || set $?
167 ebegin "Committing working copy to repository"
168 svn commit -m "$commit_message"