-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
executable file
·56 lines (46 loc) · 952 Bytes
/
setup.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
#!/bin/sh
set -e -x
die() {
echo "$1" >&2
exit 1
}
. "$PWD/config"
BASEDIR="$PWD"
[ -d repo ] || install -d repo
# setup new repositories
for RR in $REPOS
do
cd "$BASEDIR"
[ -d "repo/$RR" ] && continue
git init "repo/$RR"
cd "repo/$RR"
git remote add github "$GITBASE/$RR.git"
git remote add hg "hg::$HGBASE/$RR"
done
cd "$BASEDIR"
case "$1" in
fetch*)
REMOTE="${1#fetch}"
for RR in $REPOS
do
cd "$BASEDIR/repo/$RR"
git fetch "$REMOTE" || true
done
;;
pushgit)
for RR in $REPOS
do
echo "Push $RR"
cd "$BASEDIR/repo/$RR"
branches=""
for br in `git branch -r|grep '^\s*hg/branches/'`
do
barebr="${br#hg/branches/}"
branches="$branches $br:refs/heads/$barebr"
done
echo "Branches: $branches"
git push --tags github $branches || true
done
;;
*) die "Unknown command $1";;
esac