瀏覽代碼

add script to update everything without detaching heads

ipatix 6 年之前
父節點
當前提交
62e3709710
共有 1 個檔案被更改,包括 50 行新增0 行删除
  1. 50
    0
      update_all.sh

+ 50
- 0
update_all.sh 查看文件

@@ -0,0 +1,50 @@
1
+#!/bin/sh
2
+
3
+main_repo=$(pwd)
4
+
5
+git_save() {
6
+    status=$(git status -s)
7
+
8
+    if [ "$status" ]; then
9
+        git stash push --include-untracked
10
+        return 0
11
+    else
12
+        return 1
13
+    fi
14
+}
15
+
16
+git_restore() {
17
+    if [ $1 -eq 0 ]; then
18
+        git stash pop
19
+    fi
20
+}
21
+
22
+# update main
23
+git pull
24
+
25
+# update battle_engine
26
+echo "*** Updating Battle Engine repository ***"
27
+cd $main_repo/battle_engine
28
+git_save
29
+result=$?
30
+git checkout master
31
+git pull
32
+git_restore $result
33
+
34
+# update g3headers
35
+echo "*** Updating g3headers repository ***"
36
+cd $main_repo/g3headers
37
+git_save
38
+result=$?
39
+git checkout master
40
+git pull
41
+git_restore $result
42
+
43
+# update private
44
+echo "*** Updating private repository ***"
45
+cd $main_repo/sots-private
46
+git_save
47
+result=$?
48
+git checkout master
49
+git pull
50
+git_restore $result