diff --git a/githooks/applypatch-msg b/githooks/applypatch-msg new file mode 100755 index 0000000..5ceb5fa --- /dev/null +++ b/githooks/applypatch-msg @@ -0,0 +1 @@ +#!/bin/python diff --git a/githooks/commit-msg b/githooks/commit-msg new file mode 100755 index 0000000..e69de29 diff --git a/githooks/install.sh b/githooks/install.sh new file mode 100755 index 0000000..ee13630 --- /dev/null +++ b/githooks/install.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +basepath=$(cd `dirname $0`; pwd) +githooks_dir=${basepath}/../../../../.git/hooks + +if [ ! -L $githooks_dir/applypatch-msg ]; then + ln -s $basepath/applypatch-msg $githooks_dir/applypatch-msg +fi + +if [ ! -L $githooks_dir/commit-msg ]; then + ln -s $basepath/commit-msg $githooks_dir/commit-msg +fi + +if [ ! -L $githooks_dir/post-update ]; then + ln -s $basepath/post-update $githooks_dir/post-update +fi + +if [ ! -L $githooks_dir/pre-applypatch ]; then + ln -s $basepath/pre-applypatch $githooks_dir/pre-applypatch +fi + +if [ ! -L $githooks_dir/pre-commit ]; then + ln -s $basepath/pre-commit $githooks_dir/pre-commit +fi + +if [ ! -L $githooks_dir/prepare-commit-msg ]; then + ln -s $basepath/prepare-commit-msg $githooks_dir/prepare-commit-msg +fi + +if [ ! -L $githooks_dir/pre-push ]; then + ln -s $basepath/pre-push $githooks_dir/pre-push +fi + +if [ ! -L $githooks_dir/pre-rebase ]; then + ln -s $basepath/pre-rebase $githooks_dir/pre-rebase +fi + +if [ ! -L $githooks_dir/update ]; then + ln -s $basepath/update $githooks_dir/update +fi diff --git a/githooks/post-update b/githooks/post-update new file mode 100755 index 0000000..e69de29 diff --git a/githooks/pre-applypatch b/githooks/pre-applypatch new file mode 100755 index 0000000..e69de29 diff --git a/githooks/pre-commit b/githooks/pre-commit new file mode 100755 index 0000000..fd90653 --- /dev/null +++ b/githooks/pre-commit @@ -0,0 +1,21 @@ +#!/bin/bash + +env |grep -q "is_out_net" +if [ $? -eq 0 ]; then + exit 0 +fi + +# git branch|grep -q "* dev" +# if [ $? -ne 0 ]; then +# echo 'not dev branch, exit' +# exit 0 +# fi + +# echo 'no sync protocol to svn' + +git branch|grep -q "* master" +if [ $? -eq 0 ]; then + svn update ~/opensource/game1008_proto + cp -f server/tools/protobuild/cs_*.proto ~/opensource/game1008_proto + svn commit -m '同步协议' ~/opensource/game1008_proto +fi diff --git a/githooks/pre-push b/githooks/pre-push new file mode 100755 index 0000000..e69de29 diff --git a/githooks/pre-rebase b/githooks/pre-rebase new file mode 100755 index 0000000..e69de29 diff --git a/githooks/prepare-commit-msg b/githooks/prepare-commit-msg new file mode 100755 index 0000000..e69de29 diff --git a/githooks/update b/githooks/update new file mode 100755 index 0000000..e69de29 diff --git a/scripts/construct/build_pb.py b/scripts/construct/build_pb.py index 166b764..43e0149 100644 --- a/scripts/construct/build_pb.py +++ b/scripts/construct/build_pb.py @@ -102,8 +102,8 @@ parser.add_option( help = "", ) (options, args) = parser.parse_args() -#if not options.nohooks: -# repair_githooks() +if not options.nohooks: + repair_githooks() if need_rebuild(options.pb_files.split(',')): rebuild(options.cpp_out, options.python_out, options.pb_files.split(','))