3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
24 # Updates all the branches in the local repo (clones if it does not exist)
25 if [ -d $OSM_MDG ]; then
26 INFO "reusing existing workspace"
28 GIT fetch --all --tags
29 #git checkout master #to make sure that we are in the right branch before pulling the code
32 INFO "cloning MDG $OSM_MDG from $OSM_GIT_URL/$OSM_MDG"
33 GIT clone $OSM_GIT_URL/$OSM_MDG
35 for remote in `git branch -r |grep -v /HEAD`; do GIT branch --track ${remote#origin/} $remote; done
39 if [ "$1" = "checkout" ]; then
40 INFO "Code to compile: '$2'"
43 INFO "Code to compile: gerrit refspec '$1', commit-id: '$2'"
44 GIT fetch origin $1 || FATAL "git fetch origin '$1' didn't work"
45 GIT checkout -f $2 || FATAL "git checkout -f '$2' didn't work"
48 INFO "Code to compile: master"