2 # review - Move a certain revision from sunrise/ to reviewed/
3 # Released into the public domain
5 source /etc/init.d/functions.sh
20 DIFF_OPTS="${DIFF_OPTS:--Nur}"
23 if [[ "$opt_noupdate" == "0" ]] ; then
26 local conflict_files=$(svn status | sed -rn 's/^C.+ ([^ ]+)$/\1/p')
27 if [[ -n "$conflict_files" ]] ; then
28 echo "!!! Error: Some local files have changes that conflict with the latest"
29 echo "!!! revisions in the repository. Please contact the previous committer(s) to"
30 echo "!!! resolve the conflicts manually before running sunrise-commit again:"
31 for filename in $conflict_files ; do
33 echo "!!! file: ${filename}"
34 echo "!!! committer: $(svn info ${filename} | sed -rn 's/Last Changed Author\: (.*)$/\1/p')"
43 if [[ "$opt_norepoman" == "0" ]] ; then
44 ebegin "Running repoman"
45 export PORTDIR_OVERLAY="$(pwd)"
54 ${BOLD}Usage:${NORMAL} ${LIGHTBLUE}$0${NORMAL} [ ${GREEN}options${NORMAL} ] ${BLUE}revision${NORMAL}
56 ${GREEN}options${NORMAL}:
57 ${BOLD}--help, -h${NORMAL} Show help
58 ${BOLD}--norepoman, -p${NORMAL} Skip repoman check
59 ${BOLD}--noupdate, -d${NORMAL} Don't update from repository before committing
60 ${BOLD}--quiet, -q${NORMAL} Don't ask for confirmation
61 ${BOLD}--verbose, -v${NORMAL} Show detailed information during commit
66 while [[ $# > 0 ]] ; do
88 echo "!!! Error: Unknown option ${1}. See: sunrise-commit -h"
96 cd sunrise || { eerror "You must run this script from the top level of the sunrise subversion repository."; exit 1; }
97 LC_ALL="C" ls -d *-* > profiles/categories
98 if [[ $(svn diff profiles/categories) ]]; then
99 svn diff profiles/categories | if [[ "$opt_quiet" == "0" ]] ; then less; else cat; fi
100 echo -n "${BOLD}Commit changes?${NORMAL} [${GREEN}Yes${NORMAL}/${RED}No${NORMAL}] "
105 svn commit -m "Automatic update to categories" profiles/categories || exit 1
113 LC_ALL="C" sh scripts/use_desc_gen.sh . || exit $?
114 if [[ $(svn diff profiles/use.local.desc) ]]; then
115 svn diff profiles/use.local.desc | if [[ "$opt_quiet" == "0" ]] ; then less; else cat; fi
116 echo -n "${BOLD}Commit changes?${NORMAL} [${GREEN}Yes${NORMAL}/${RED}No${NORMAL}] "
121 svn commit -m "Automatic update to use.local.desc" profiles/use.local.desc || exit 1
131 if [[ -z "$*" ]] ; then
132 ebegin "Updating working copy to latest version from repository"
134 if [[ "$opt_verbose" == "1" ]] ; then
137 update=$(echo $update|awk '// {print $NF}' )
138 sunrise_revision=${update/.}
139 [ "$sunrise_revision" -lt "10" ] && exit 1
141 #elif [[ "$*" =~ "^[0-9]*$" ]]; then
142 # echo "!!! Error: The revision must be an integer value $*"
147 ebegin "Updating working copy to latest version from repository"
148 svn_up -r $sunrise_revision || exit $?
152 if ! [ -e sunrise ] || ! [ -e reviewed ]; then
153 eerror "You need to have sunrise and reviewed subdirs"
157 reviewed_revision=$(svn log reviewed 2>/dev/null | grep "Reviewed up to revision " -m 1 | sed "s:Reviewed up to revision ::")
159 if [ $reviewed_revision -gt $sunrise_revision ]; then
160 eerror "a newer revision is already reviewed"
166 repoman_check || exit $?
168 ebegin "Running portdupe"
173 if [[ "$opt_quiet" == "0" ]] ; then
174 which diffstat >/dev/null 2>&1 && diff -Nur reviewed sunrise --exclude=.svn | diffstat
175 ${DIFF} ${DIFF_OPTS} reviewed sunrise --exclude=Manifest --exclude=.svn --exclude=metadata.xml --exclude=digest-*
177 ) | if [[ "$opt_quiet" == "0" ]] ; then less; else cat; fi
179 if [[ "$opt_quiet" == "0" ]] ; then
181 echo -n "${BOLD}Commit changes?${NORMAL} [${GREEN}Yes${NORMAL}/${RED}No${NORMAL}] "
196 ebegin "Merging in changes..."
197 if [[ "$opt_verbose" == "1" ]] ; then
198 svn merge sunrise@$reviewed_revision sunrise@$sunrise_revision reviewed
200 svn merge sunrise@$reviewed_revision sunrise@$sunrise_revision reviewed -q
204 ebegin "Committing working copy to repository"
205 svn commit reviewed -m "Reviewed up to revision $sunrise_revision"