OLD | NEW |
1 #!/usr/bin/env bash | 1 #!/usr/bin/env bash |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # This script will try to sync the bootstrap directories and then defer control. | 6 # This script will try to sync the bootstrap directories and then defer control. |
7 | 7 |
8 if [ "$USER" == "root" ]; | 8 if [ "$USER" == "root" ]; |
9 then | 9 then |
10 echo Running depot tools as root is sad. | 10 echo Running depot tools as root is sad. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 exit 1 | 62 exit 1 |
63 fi | 63 fi |
64 } | 64 } |
65 | 65 |
66 function is_git_clone_repo { | 66 function is_git_clone_repo { |
67 "$GIT" config remote.origin.fetch > /dev/null | 67 "$GIT" config remote.origin.fetch > /dev/null |
68 } | 68 } |
69 | 69 |
70 function update_git_repo { | 70 function update_git_repo { |
71 if is_git_clone_repo; then | 71 if is_git_clone_repo; then |
72 git fetch -q origin > /dev/null | 72 git fetch -q origin &> /dev/null |
73 git rebase -q origin/master > /dev/null | 73 local REBASE_TXT=$(git rebase -q origin/master 2>&1) |
74 return 0 | 74 local STATUS=$? |
| 75 if [[ $STATUS != 0 ]]; then |
| 76 echo "depot_tools update failed. Conflict in $base_dir" >&2 |
| 77 echo "$REBASE_TXT" >&2 |
| 78 git rebase --abort 2> /dev/null |
| 79 fi |
| 80 return $STATUS |
75 fi | 81 fi |
76 | 82 |
77 test_git_svn | 83 test_git_svn |
78 # work around a git-svn --quiet bug | 84 # work around a git-svn --quiet bug |
79 OUTPUT=`"$GIT" svn rebase -q -q` | 85 OUTPUT=`"$GIT" svn rebase -q -q` |
80 if [[ ! "$OUTPUT" == *Current.branch* ]]; then | 86 if [[ ! "$OUTPUT" == *Current.branch* ]]; then |
81 echo $OUTPUT 1>&2 | 87 echo $OUTPUT 1>&2 |
82 fi | 88 fi |
83 return 0 | 89 return 0 |
84 } | 90 } |
(...skipping 18 matching lines...) Expand all Loading... |
103 # Update the root directory to stay up-to-date with the latest depot_tools. | 109 # Update the root directory to stay up-to-date with the latest depot_tools. |
104 BEFORE_REVISION=$(get_svn_revision) | 110 BEFORE_REVISION=$(get_svn_revision) |
105 "$SVN" -q up "$base_dir" | 111 "$SVN" -q up "$base_dir" |
106 AFTER_REVISION=$(get_svn_revision) | 112 AFTER_REVISION=$(get_svn_revision) |
107 if [[ "$BEFORE_REVISION" != "$AFTER_REVISION" ]]; then | 113 if [[ "$BEFORE_REVISION" != "$AFTER_REVISION" ]]; then |
108 echo "Depot Tools has been updated to revision $AFTER_REVISION." 1>&2 | 114 echo "Depot Tools has been updated to revision $AFTER_REVISION." 1>&2 |
109 fi | 115 fi |
110 fi | 116 fi |
111 | 117 |
112 find "$base_dir" -iname "*.pyc" -exec rm {} \; | 118 find "$base_dir" -iname "*.pyc" -exec rm {} \; |
OLD | NEW |