Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame^] | 1 | #!/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 |
| 12 | safe_run git checkout master |
| 13 | echo " + Fetching origin..." |
| 14 | safe_run git fetch origin |
| 15 | if is_git_svn; then |
| 16 | echo " + Rebasing SVN master..." |
| 17 | safe_run git svn rebase -l |
| 18 | else |
| 19 | echo " + Rebasing master..." |
| 20 | safe_run git pull |
| 21 | fi |
| 22 | |
| 23 | # Fetch all other remotes |
| 24 | if [[ $1 = 'all' ]]; then |
| 25 | for remote in `git remote`; do |
| 26 | if [ "$remote" != "origin" ]; then |
| 27 | echo " + Fetching remote $remote..." |
| 28 | safe_run git fetch $remote |
| 29 | fi |
| 30 | done |
| 31 | fi |