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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 72 } |
73 | 73 |
74 function update_git_repo { | 74 function update_git_repo { |
75 remote_url=$("$GIT" config --get remote.origin.url) | 75 remote_url=$("$GIT" config --get remote.origin.url) |
76 if [ -n "$remote_url" -a "$remote_url" != "$CANONICAL_GIT_URL" ]; then | 76 if [ -n "$remote_url" -a "$remote_url" != "$CANONICAL_GIT_URL" ]; then |
77 echo "Your copy of depot_tools is configured to fetch from an obsolete URL:" | 77 echo "Your copy of depot_tools is configured to fetch from an obsolete URL:" |
78 echo | 78 echo |
79 echo " $remote_url" | 79 echo " $remote_url" |
80 echo | 80 echo |
81 read -t 60 -p "OK to update it to $CANONICAL_GIT_URL ? [Y/n] " -n 1 | 81 read -t 60 -p "OK to update it to $CANONICAL_GIT_URL ? [Y/n] " -n 1 |
| 82 STATUS=$? |
82 echo | 83 echo |
83 if [ $? -ne "0" ]; then | 84 if [[ $STATUS -ne 0 ]]; then |
84 echo "Timeout; not updating remote URL." | 85 echo "Timeout; not updating remote URL." |
85 elif [ -z "$REPLY" -o "$REPLY" = "Y" -o "$REPLY" = "y" ]; then | 86 elif [ -z "$REPLY" -o "$REPLY" = "Y" -o "$REPLY" = "y" ]; then |
86 "$GIT" config remote.origin.url "$CANONICAL_GIT_URL" | 87 "$GIT" config remote.origin.url "$CANONICAL_GIT_URL" |
87 echo "Remote URL updated." | 88 echo "Remote URL updated." |
88 fi | 89 fi |
89 fi | 90 fi |
90 | 91 |
91 if is_git_clone_repo; then | 92 if is_git_clone_repo; then |
92 git fetch -q origin &> /dev/null | 93 git fetch -q origin &> /dev/null |
93 local REBASE_TXT STATUS | 94 local REBASE_TXT STATUS |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 # Update the root directory to stay up-to-date with the latest depot_tools. | 131 # Update the root directory to stay up-to-date with the latest depot_tools. |
131 BEFORE_REVISION=$(get_svn_revision) | 132 BEFORE_REVISION=$(get_svn_revision) |
132 "$SVN" -q up "$base_dir" | 133 "$SVN" -q up "$base_dir" |
133 AFTER_REVISION=$(get_svn_revision) | 134 AFTER_REVISION=$(get_svn_revision) |
134 if [[ "$BEFORE_REVISION" != "$AFTER_REVISION" ]]; then | 135 if [[ "$BEFORE_REVISION" != "$AFTER_REVISION" ]]; then |
135 echo "Depot Tools has been updated to revision $AFTER_REVISION." 1>&2 | 136 echo "Depot Tools has been updated to revision $AFTER_REVISION." 1>&2 |
136 fi | 137 fi |
137 fi | 138 fi |
138 | 139 |
139 find "$base_dir" -iname "*.pyc" -exec rm {} \; | 140 find "$base_dir" -iname "*.pyc" -exec rm {} \; |
OLD | NEW |