cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject git commit: updated refs/heads/master to 8d27c19
Date Wed, 06 Aug 2014 20:38:14 GMT
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 <rohit.yadav@shapeblue.com>


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 <rohit.yadav@shapeblue.com>
Authored: Wed Aug 6 22:37:22 2014 +0200
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
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"


Mime
View raw message