2 # review - Move a certain revision from sunrise/ to reviewed/
3 # Released into the public domain
5 source /etc/init.d/functions.sh
20 if [[ "$opt_noupdate" == "0" ]] ; then
23 local conflict_files=$(svn status | sed -rn 's/^C.+ ([^ ]+)$/\1/p')
24 if [[ -n "$conflict_files" ]] ; then
25 echo "!!! Error: Some local files have changes that conflict with the latest"
26 echo "!!! revisions in the repository. Please contact the previous committer(s) to"
27 echo "!!! resolve the conflicts manually before running sunrise-commit again:"
28 for filename in $conflict_files ; do
30 echo "!!! file: ${filename}"
31 echo "!!! committer: $(svn info ${filename} | sed -rn 's/Last Changed Author\: (.*)$/\1/p')"
40 if [[ "$opt_norepoman" == "0" ]] ; then
41 ebegin "Running repoman"
42 export PORTDIR_OVERLAY="$(pwd)"
51 ${BOLD}Usage:${NORMAL} ${LIGHTBLUE}$0${NORMAL} [ ${GREEN}options${NORMAL} ] ${BLUE}revision${NORMAL}
53 ${GREEN}options${NORMAL}:
54 ${BOLD}--help, -h${NORMAL} Show help
55 ${BOLD}--norepoman, -p${NORMAL} Skip repoman check
56 ${BOLD}--noupdate, -d${NORMAL} Don't update from repository before committing
57 ${BOLD}--quiet, -q${NORMAL} Don't ask for confirmation
58 ${BOLD}--verbose, -v${NORMAL} Show detailed information during commit
63 while [[ $# > 0 ]] ; do
85 echo "!!! Error: Unknown option ${1}. See: sunrise-commit -h"
94 ls -d *-* > profiles/categories
95 if [[ $(svn diff profiles/categories) ]]; then
96 svn diff profiles/categories | if [[ "$opt_quiet" == "0" ]] ; then less; else cat; fi
97 echo -n "${BOLD}Commit changes?${NORMAL} [${GREEN}Yes${NORMAL}/${RED}No${NORMAL}] "
102 svn commit -m "Automatic update to categories" profiles/categories || exit
110 sh scripts/use_desc_gen.sh . || exit $?
111 if [[ $(svn diff profiles/use.local.desc) ]]; then
112 svn diff profiles/use.local.desc | if [[ "$opt_quiet" == "0" ]] ; then less; else cat; fi
113 echo -n "${BOLD}Commit changes?${NORMAL} [${GREEN}Yes${NORMAL}/${RED}No${NORMAL}] "
118 svn commit -m "Automatic update to use.local.desc" profiles/use.local.desc || exit
128 if [[ -z "$*" ]] ; then
129 ebegin "Updating working copy to latest version from repository"
131 if [[ "$opt_verbose" == "1" ]] ; then
134 update=$(echo $update | tail -n 1)
135 update=${update/Revision }
136 sunrise_revision=${update/.}
137 [ "$sunrise_revision" -lt "10" ] && exit 1
139 #elif [[ "$*" =~ "^[0-9]*$" ]]; then
140 # echo "!!! Error: The revision must be an integer value $*"
145 ebegin "Updating working copy to latest version from repository"
146 svn_up -r $sunrise_revision || exit $?
150 if ! [ -e sunrise ] || ! [ -e reviewed ]; then
151 eerror "You need to have sunrise and reviewed subdirs"
155 reviewed_revision=$(svn log reviewed 2>/dev/null | grep "Reviewed up to revision " -m 1 | sed "s:Reviewed up to revision ::")
157 if [ $reviewed_revision -gt $sunrise_revision ]; then
158 eerror "a newer revision is already reviewed"
164 repoman_check || exit $?
166 ebegin "Running portdupe"
171 if [[ "$opt_quiet" == "0" ]] ; then
172 which diffstat >/dev/null 2>&1 && diff -Nur reviewed sunrise --exclude=.svn | diffstat
173 diff -Nur reviewed sunrise --exclude=Manifest --exclude=.svn --exclude=metadata.xml --exclude=digest-*
175 ) | if [[ "$opt_quiet" == "0" ]] ; then less; else cat; fi
177 if [[ "$opt_quiet" == "0" ]] ; then
179 echo -n "${BOLD}Commit changes?${NORMAL} [${GREEN}Yes${NORMAL}/${RED}No${NORMAL}] "
194 ebegin "Merging in changes..."
195 if [[ "$opt_verbose" == "1" ]] ; then
196 svn merge sunrise@$reviewed_revision sunrise@$sunrise_revision reviewed
198 svn merge sunrise@$reviewed_revision sunrise@$sunrise_revision reviewed -q
202 ebegin "Committing working copy to repository"
203 svn commit reviewed -m "Reviewed up to revision $sunrise_revision"