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
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"
106 #elif [[ "$*" =~ "^[0-9]*$" ]]; then
107 # echo "!!! Error: The revision must be an integer value $*"
112 svn_up -r $sunrise_revision || exit $?
114 if ! [ -e sunrise ] || ! [ -e reviewed ]; then
115 eerror "You need to have sunrise and reviewed subdirs"
119 reviewed_revision=$(svn log reviewed 2>/dev/null | grep "Reviewed up to revision " -m 1 | sed "s:Reviewed up to revision ::")
121 if [ $reviewed_revision -gt $sunrise_revision ]; then
122 eerror "a newer revision is already reviewed"
128 repoman_check || exit $?
130 ebegin "Running portdupe"
135 if [[ "$opt_quiet" == "0" ]] ; then
136 which diffstat >/dev/null 2>&1 && diff -Nur reviewed sunrise --exclude=.svn | diffstat
137 diff -Nur reviewed sunrise --exclude=Manifest --exclude=.svn --exclude=metadata.xml --exclude=digest-*
139 ) | if [[ "$opt_quiet" == "0" ]] ; then less; else cat; fi
141 if [[ "$opt_quiet" == "0" ]] ; then
143 echo -n "${BOLD}Commit changes?${NORMAL} [${GREEN}Yes${NORMAL}/${RED}No${NORMAL}] "
158 ebegin "Merging in changes..."
159 if [[ "$opt_verbose" == "1" ]] ; then
160 svn merge sunrise@$reviewed_revision sunrise@$sunrise_revision reviewed
162 svn merge sunrise@$reviewed_revision sunrise@$sunrise_revision reviewed -q
166 ebegin "Committing working copy to repository"
167 svn commit reviewed -m "Reviewed up to revision $*"