blob: 100654f6c3a14f820821d04513249ca8fa1c7ee4 [file] [log] [blame]
Renato Golin94cc1042016-04-26 11:02:23 +01001#!/usr/bin/env bash
2
3# This script refreshes the local repository with the contents of the
4# upstream repository. The main usage of this is to pull the
5# master branch, and sync git-svn if necessary.
6#
7# Syntax: git-refresh [all]
8
9. llvm-common
10
11# Update from origin to upstream
Diana Picus72189fd2016-05-23 19:32:46 +030012master_dir=`git rev-parse --git-common-dir`
13
14pushdq $master_dir/../
15trap popdq EXIT
16
Renato Golin94cc1042016-04-26 11:02:23 +010017safe_run git checkout master
18echo " + Fetching origin..."
19safe_run git fetch origin
20if is_git_svn; then
21 echo " + Rebasing SVN master..."
22 safe_run git svn rebase -l
23else
24 echo " + Rebasing master..."
25 safe_run git pull
26fi
27
28# Fetch all other remotes
29if [[ $1 = 'all' ]]; then
30 for remote in `git remote`; do
31 if [ "$remote" != "origin" ]; then
32 echo " + Fetching remote $remote..."
33 safe_run git fetch $remote
34 fi
35 done
36fi