Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 22781113B9 for ; Wed, 6 Aug 2014 20:38:16 +0000 (UTC) Received: (qmail 80968 invoked by uid 500); 6 Aug 2014 20:38:16 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 80939 invoked by uid 500); 6 Aug 2014 20:38:15 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 80930 invoked by uid 99); 6 Aug 2014 20:38:15 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Aug 2014 20:38:15 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B97B09C10E7; Wed, 6 Aug 2014 20:38:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bhaisaab@apache.org To: commits@cloudstack.apache.org Message-Id: <44e5b0ab680f4ecebccb147234e591de@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/master to 8d27c19 Date: Wed, 6 Aug 2014 20:38:14 +0000 (UTC) Repository: cloudstack Updated Branches: refs/heads/master c09888fcb -> 8d27c19ae tools/git: add git hook to help self police schema changes Signed-off-by: Rohit Yadav Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8d27c19a Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8d27c19a Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8d27c19a Branch: refs/heads/master Commit: 8d27c19ae2a2c5aa49690a76415aaffc65758643 Parents: c09888f Author: Rohit Yadav Authored: Wed Aug 6 22:37:22 2014 +0200 Committer: Rohit Yadav Committed: Wed Aug 6 22:37:22 2014 +0200 ---------------------------------------------------------------------- tools/git/db-police | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d27c19a/tools/git/db-police ---------------------------------------------------------------------- diff --git a/tools/git/db-police b/tools/git/db-police new file mode 100755 index 0000000..c2fd8ce --- /dev/null +++ b/tools/git/db-police @@ -0,0 +1,48 @@ +#!/bin/sh +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# CloudStack DB Schema Police +# =========================== +# +# Modify and install in .git/hooks/ +# Use this script as following hooks: +# post-merge - when git merge or git pull runs +# post-rewrite - whenever commit is ammended or git rebase is run +# pre-rebase - before rebase runs +# +# Install: +# for file in post-merge post-rewrite pre-rebase; do cp db-police "../../.git/hooks/$file"; done + +changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" + +check_changes() { + echo "\nList of changed files since original refs:" + echo "$changed_files\n" + + alert_command="" + if [ "$(uname)" == "Darwin" ]; then + alert_command="say '$1'" + elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then + alert_command="command -v festival && $(echo '$1' | festival --tts)" + fi + + echo "$changed_files" | grep --quiet "setup/db" && eval $alert_command +} + +check_changes "Alert, somebody changed CloudStack schemas"