diff options
author | 2012-04-02 16:45:25 +0200 | |
---|---|---|
committer | 2012-04-02 16:45:25 +0200 | |
commit | 8ecd770ba8d32fbde866f7f084b19afba795d7fd (patch) | |
tree | f47d88050cc8f59446315081cb2eadf86108345a /scripts | |
parent | app-portage/overlay-utils: Version bump, switch to git (diff) | |
download | sunrise-8ecd770ba8d32fbde866f7f084b19afba795d7fd.tar.gz sunrise-8ecd770ba8d32fbde866f7f084b19afba795d7fd.tar.bz2 sunrise-8ecd770ba8d32fbde866f7f084b19afba795d7fd.zip |
scripts/review: Switch review script to git
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/review | 87 |
1 files changed, 15 insertions, 72 deletions
diff --git a/scripts/review b/scripts/review index cc19f0e7a..03e8743e5 100755 --- a/scripts/review +++ b/scripts/review @@ -19,26 +19,6 @@ opt_verbose=0 DIFF="${DIFF:-diff}" DIFF_OPTS="${DIFF_OPTS:--Nur}" -svn_up() { - if [[ "$opt_noupdate" == "0" ]] ; then - svn update $* - - 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 0 -} - repoman_check() { if [[ "$opt_norepoman" == "0" ]] ; then ebegin "Running repoman" @@ -85,7 +65,7 @@ while [[ $# > 0 ]] ; do shift ;; -*) - echo "!!! Error: Unknown option ${1}. See: sunrise-commit -h" + echo "!!! Error: Unknown option ${1}. See: $0 -h" exit 1 ;; *) @@ -93,16 +73,15 @@ while [[ $# > 0 ]] ; do esac done -cd sunrise || { eerror "You must run this script from the top level of the sunrise subversion repository."; exit 1; } LC_ALL="C" ls -d *-* > profiles/categories -if [[ $(svn diff profiles/categories) ]]; then - svn diff profiles/categories | if [[ "$opt_quiet" == "0" ]] ; then less; else cat; fi +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*|"") - svn commit -m "Automatic update to categories" profiles/categories || exit 1 + git commit -m "Automatic update to categories" profiles/categories || exit 1 ;; *) echo "Quitting." @@ -111,14 +90,14 @@ if [[ $(svn diff profiles/categories) ]]; then esac fi LC_ALL="C" sh scripts/use_desc_gen.sh . || exit $? -if [[ $(svn diff profiles/use.local.desc) ]]; then - svn diff profiles/use.local.desc | if [[ "$opt_quiet" == "0" ]] ; then less; else cat; fi +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*|"") - svn commit -m "Automatic update to use.local.desc" profiles/use.local.desc || exit 1 + git commit -m "Automatic update to use.local.desc" profiles/use.local.desc || exit 1 ;; *) echo "Quitting." @@ -126,53 +105,19 @@ if [[ $(svn diff profiles/use.local.desc) ]]; then exit ;; esac fi -cd .. - -if [[ -z "$*" ]] ; then - ebegin "Updating working copy to latest version from repository" - update=$(svn_up) - if [[ "$opt_verbose" == "1" ]] ; then - echo "$update" - fi - update=$(echo $update|awk '// {print $NF}' ) - sunrise_revision=${update/.} - [ "$sunrise_revision" -lt "10" ] && exit 1 - eend -#elif [[ "$*" =~ "^[0-9]*$" ]]; then -# echo "!!! Error: The revision must be an integer value $*" -# exit 1 -else - sunrise_revision=$* - - ebegin "Updating working copy to latest version from repository" - svn_up -r $sunrise_revision || exit $? - eend -fi - -if ! [ -e sunrise ] || ! [ -e reviewed ]; then - eerror "You need to have sunrise and reviewed subdirs" - exit 1 -fi -reviewed_revision=$(svn log reviewed 2>/dev/null | grep "Reviewed up to revision " -m 1 | sed "s:Reviewed up to revision ::") +ebegin "Updating working copy to latest version from repository" +git pull --rebase -if [ $reviewed_revision -gt $sunrise_revision ]; then - eerror "a newer revision is already reviewed" - exit 1 -fi ( -cd sunrise - repoman_check || exit $? ebegin "Running portdupe" scripts/portdupe eend $? -cd .. if [[ "$opt_quiet" == "0" ]] ; then - which diffstat >/dev/null 2>&1 && diff -Nur reviewed sunrise --exclude=.svn | diffstat - ${DIFF} ${DIFF_OPTS} reviewed sunrise --exclude=Manifest --exclude=.svn --exclude=metadata.xml --exclude=digest-* + git diff master reviewed/master fi ) | if [[ "$opt_quiet" == "0" ]] ; then less; else cat; fi @@ -193,14 +138,12 @@ if [[ "$opt_quiet" == "0" ]] ; then esac fi -ebegin "Merging in changes..." +ebegin "Pushing changes..." if [[ "$opt_verbose" == "1" ]] ; then - svn merge sunrise@$reviewed_revision sunrise@$sunrise_revision reviewed + git push -v origin + git push -v reviewed else - svn merge sunrise@$reviewed_revision sunrise@$sunrise_revision reviewed -q + git push origin + git push reviewed fi eend ${?} - -ebegin "Committing working copy to repository" -svn commit reviewed -m "Reviewed up to revision $sunrise_revision" -eend $? |