OLD | NEW |
1 #!/usr/bin/env bash | 1 #!/usr/bin/env bash |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 base_dir=$(dirname "$0") | 8 base_dir=$(dirname "$0") |
9 if [ -L "$base_dir" ] | 9 if [ -L "$base_dir" ] |
10 then | 10 then |
(...skipping 26 matching lines...) Expand all Loading... |
37 GITV="${GITV% (svn*}" | 37 GITV="${GITV% (svn*}" |
38 local GITD=( ${GITV//./ } ) # Split version number into decimals | 38 local GITD=( ${GITV//./ } ) # Split version number into decimals |
39 if ((GITD[0] < 1 || (GITD[0] == 1 && GITD[1] < 6) )); then | 39 if ((GITD[0] < 1 || (GITD[0] == 1 && GITD[1] < 6) )); then |
40 echo "git version is ${GITV}, please update to a version later than 1.6" | 40 echo "git version is ${GITV}, please update to a version later than 1.6" |
41 exit 1 | 41 exit 1 |
42 fi | 42 fi |
43 } | 43 } |
44 | 44 |
45 # Get the current SVN revision. | 45 # Get the current SVN revision. |
46 get_svn_revision() { | 46 get_svn_revision() { |
47 echo `svn info "$base_dir" | awk '{ if ($1 == "Revision:") { print $2 }}'` | 47 LANGUAGE=C svn info "$base_dir" | \ |
| 48 awk -F': ' '{ if ($1 == "Last Changed Rev") { print $2 }}' |
48 } | 49 } |
49 | 50 |
50 # Update git checkouts. | 51 # Update git checkouts. |
51 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.git" ] | 52 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.git" ] |
52 then | 53 then |
53 cd $base_dir | 54 cd $base_dir |
54 test_git_svn | 55 test_git_svn |
55 # work around a git-svn --quiet bug | 56 # work around a git-svn --quiet bug |
56 OUTPUT=`git svn rebase -q -q` | 57 OUTPUT=`git svn rebase -q -q` |
57 if [[ ! "$OUTPUT" == *Current.branch* ]]; then | 58 if [[ ! "$OUTPUT" == *Current.branch* ]]; then |
58 echo $OUTPUT 1>&2 | 59 echo $OUTPUT 1>&2 |
59 fi | 60 fi |
60 cd - > /dev/null | 61 cd - > /dev/null |
61 fi | 62 fi |
62 | 63 |
63 # We're on POSIX. We can now safely look for svn checkout. | 64 # We're on POSIX. We can now safely look for svn checkout. |
64 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.svn" ] | 65 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.svn" ] |
65 then | 66 then |
66 # Update the bootstrap directory to stay up-to-date with the latest | 67 # Update the bootstrap directory to stay up-to-date with the latest |
67 # depot_tools. | 68 # depot_tools. |
68 BEFORE_REVISION=$(get_svn_revision) | 69 BEFORE_REVISION=$(get_svn_revision) |
69 svn -q up "$base_dir" | 70 svn -q up "$base_dir" |
70 AFTER_REVISION=$(get_svn_revision) | 71 AFTER_REVISION=$(get_svn_revision) |
71 if [[ "$BEFORE_REVISION" != "$AFTER_REVISION" ]]; then | 72 if [[ "$BEFORE_REVISION" != "$AFTER_REVISION" ]]; then |
72 echo "Depot Tools has been updated to revision $AFTER_REVISION." 1>&2 | 73 echo "Depot Tools has been updated to revision $AFTER_REVISION." 1>&2 |
73 fi | 74 fi |
74 fi | 75 fi |
OLD | NEW |