blob: d42381287cbe1f02d1a429c5509df7a2cadbebce [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
Renato Golin98312fe2017-04-13 17:05:31 +010020safe_run git remote update -p
21
Renato Golin94cc1042016-04-26 11:02:23 +010022if is_git_svn; then
23 echo " + Rebasing SVN master..."
24 safe_run git svn rebase -l
25else
26 echo " + Rebasing master..."
27 safe_run git pull
28fi
29
30# Fetch all other remotes
31if [[ $1 = 'all' ]]; then
32 for remote in `git remote`; do
33 if [ "$remote" != "origin" ]; then
34 echo " + Fetching remote $remote..."
35 safe_run git fetch $remote
36 fi
37 done
38fi