From: Doug Wiegley Date: Wed, 13 Jan 2016 22:07:12 +0000 (-0600) Subject: Add --dry-run mode to code review abandon tool X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=875175ae9c4aa7b050016564707bc5c3f10e2cea;p=openstack-build%2Fneutron-build.git Add --dry-run mode to code review abandon tool Usually I edit the script every time, to see what it would do before the actual run. Add that mode via a flag. Change-Id: I3ea50b905217947a43e4437b4925bb79c45a3d18 --- diff --git a/tools/abandon_old_reviews.sh b/tools/abandon_old_reviews.sh index 2cb08a7d2..96afa28ce 100755 --- a/tools/abandon_old_reviews.sh +++ b/tools/abandon_old_reviews.sh @@ -28,15 +28,26 @@ # first purge the all reviews that are more than 4w old and blocked by a core -2 +if [ "$1" = "--dry-run" ]; then + echo "Enabling dry run mode" + DRY_RUN=1 +else + DRY_RUN=0 +fi + set -o errexit function abandon_review { local gitid=$1 shift local msg=$@ - echo "Abandoning $gitid" # echo ssh review.openstack.org gerrit review $gitid --abandon --message \"$msg\" - ssh review.openstack.org gerrit review $gitid --abandon --message \"$msg\" + if [ $DRY_RUN -eq 1 ]; then + echo "Would abandon $gitid" + else + echo "Abandoning $gitid" + ssh review.openstack.org gerrit review $gitid --abandon --message \"$msg\" + fi } PROJECTS="(project:openstack/neutron OR project:openstack/neutron-fwaas OR \