Let's make upload via SSH optional, not mandadory.
[jprojects-scripts.git] / pull-stick.sh
1 #!/bin/bash
2
3 . ./.jprojects.sh || exit 255
4
5 for project in ${LIST}; do
6         if [ ! -d "${JPROJECTS_HOME}/${project}" ]
7         then
8                 echo "$0: Project '${project}' does not exist."
9                 continue
10         fi
11
12         cd "${JPROJECTS_HOME}/${project}" || exit 255
13
14         if [ -n "$2" ]
15         then
16                 git branch -D "$2"
17         fi
18
19         if [ "$1" = "c" ]
20         then
21                 echo "$0: Checkout '${project}' ..."
22                 git checkout -- .
23         elif [ "$1" = "r" ]
24         then
25                 echo "$0: Resetting '${project}' ..."
26                 git reset --hard
27         fi
28
29         echo "$0: Pulling '${project}' ..."
30
31         git pull -S origin master
32         git fetch upstream
33         git fetch transport
34
35         echo "$0: Merging upstream into '${project}' ..."
36         git merge -S upstream/master
37
38         if [ "$1" != "s" ]
39         then
40                 echo "$0: Rebasing '${project}' ..."
41                 git rebase -Sm origin/master || exit 255
42         fi
43 done
44
45 echo "$0: All done."
46 exit 0