-
Notifications
You must be signed in to change notification settings - Fork 2
/
git-init.sh
executable file
·73 lines (70 loc) · 2.4 KB
/
git-init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
# Filename: git-init.sh
# Description: configures my git env
# Supported Langauge(s): GNU Bash 4.2.x
# Time-stamp: <2018-10-19 07:44:46 fultonj>
# -------------------------------------------------------
# Clones the repos that I am interested in.
# -------------------------------------------------------
if [[ $1 == 'oooq' ]]; then
declare -a repos=(
'openstack/tripleo-quickstart'\
'openstack/tripleo-quickstart-extras'\
);
fi
# -------------------------------------------------------
if [[ $# -eq 0 ]]; then
# uncomment whatever you want
declare -a repos=(
'openstack/tripleo-heat-templates' \
# 'openstack/tripleo-ansible' \
#'openstack/tripleo-validations' \
# 'openstack/python-tripleoclient' \
# 'openstack/puppet-ceph'\
#'openstack/heat'\
# 'openstack-infra/tripleo-ci'\
# 'openstack/tripleo-puppet-elements'\
#'openstack/tripleo-common'\
# 'openstack/tripleo-specs'\
# 'openstack/os-net-config'\
# 'openstack/tripleo-docs'\
# 'openstack/tripleo-quickstart'\
# 'openstack/tripleo-quickstart-extras'\
#'openstack/tripleo-repos'
#'openstack/puppet-nova'\
#'openstack/puppet-tripleo'\
# add the next repo here
);
fi
# -------------------------------------------------------
gerrit_user='fultonj'
git config --global user.email "[email protected]"
git config --global user.name "John Fulton"
git config --global push.default simple
git config --global gitreview.username $gerrit_user
git review --version
if [ $? -gt 0 ]; then
echo "installing git-review from upstream"
dir=/tmp/$(date | md5sum | awk {'print $1'})
mkdir $dir
pushd $dir
curl http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/g/git-review-1.24-5.el7.noarch.rpm > git-review-1.24-5.el7.noarch.rpm
sudo yum localinstall git-review-1.24-5.el7.noarch.rpm -y
popd
rm -rf $dir
fi
for repo in "${repos[@]}"; do
dir=$(echo $repo | awk 'BEGIN { FS = "/" } ; { print $2 }')
if [ ! -d $dir ]; then
git clone https://git.openstack.org/$repo.git
pushd $dir
git remote add gerrit ssh://[email protected]:29418/$repo.git
git review -s
popd
else
pushd $dir
git pull --ff-only origin master
popd
fi
done
#git remote add remove gerrit