diff options
author | Ulf Samuelsson <ulf@emagii.com> | 2011-12-20 15:16:08 +0100 |
---|---|---|
committer | Spencer Oliver <spen@spen-soft.co.uk> | 2012-04-04 08:51:17 +0000 |
commit | 8e5ea23201033f25323db1f8604a8860129c017a (patch) | |
tree | 8827e8bd30463bf1f910e9f5b3beb52152898f47 | |
parent | 1748aab2c9202783a723f6d58a204a57f1094663 (diff) | |
download | riscv-openocd-8e5ea23201033f25323db1f8604a8860129c017a.zip riscv-openocd-8e5ea23201033f25323db1f8604a8860129c017a.tar.gz riscv-openocd-8e5ea23201033f25323db1f8604a8860129c017a.tar.bz2 |
tools/initial.sh
Small script to setup Gerrit with the local repository
Usage: tools/initial.sh <username>
Change-Id: I26527c35cfe040c7752efec06064d5dc9e3ec6a2
Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
Signed-off-by: Attila Kinali <attila@kinali.ch>
Reviewed-on: http://openocd.zylin.com/290
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
-rw-r--r-- | HACKING | 5 | ||||
-rwxr-xr-x | tools/initial.sh | 37 |
2 files changed, 42 insertions, 0 deletions
@@ -86,6 +86,11 @@ wget http://openocd.zylin.com/tools/hooks/commit-msg mv commit-msg .git/hooks chmod +x .git/hooks/commit-msg @endcode +@b NOTE A script exists to simplify the two items above. execute: +@code +tools/initial.sh <username> +@endcode +With <username> being your Gerrit username. -# Set up git with your name and email: @code git config --global user.name "John Smith" diff --git a/tools/initial.sh b/tools/initial.sh new file mode 100755 index 0000000..c183d01 --- /dev/null +++ b/tools/initial.sh @@ -0,0 +1,37 @@ +#!/bin/sh +TOPDIR=`pwd` +USERNAME=$1 + +if [ "x$1" = "x" ] ; then + echo "Usage: $0 <Username>" + exit 1 +fi + +add_remote() +{ + remote_exist=`grep remote .git/config | grep review | wc -l` + if [ "x$remote_exist" = "x0" ] ; then + git remote add review ssh://$USERNAME@openocd.zylin.com:29418/openocd.git + git config remote.review.push HEAD:refs/for/master + else + echo "Remote review exists" + fi +} + +update_commit_msg() +{ + cd ${TOPDIR}/.git/hooks + save_file=commit-msg-`date +%F-%T` + mv commit-msg $save_file + printf "%-30s" "Updating commit-msg" + status="OK" + wget -o log http://openocd.zylin.com/tools/hooks/commit-msg || status="FAIL" + echo $status + if [ $status = "FAIL" ] ; then + mv $save_file commit-msg + fi + chmod a+x commit-msg +} + +add_remote +update_commit_msg |