Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: update_depot_tools

Issue 10263004: Handle updating depot_tools repos that are git cloned. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: redirect output to null Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | update_depot_tools.bat » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 GITV="${GITV#* version }" # git svn --version has extra output to remove. 57 GITV="${GITV#* version }" # git svn --version has extra output to remove.
58 GITV="${GITV% (svn*}" 58 GITV="${GITV% (svn*}"
59 local GITD=( ${GITV//./ } ) # Split version number into decimals 59 local GITD=( ${GITV//./ } ) # Split version number into decimals
60 if ((GITD[0] < 1 || (GITD[0] == 1 && GITD[1] < 6) )); then 60 if ((GITD[0] < 1 || (GITD[0] == 1 && GITD[1] < 6) )); then
61 echo "git version is ${GITV}, please update to a version later than 1.6" 61 echo "git version is ${GITV}, please update to a version later than 1.6"
62 exit 1 62 exit 1
63 fi 63 fi
64 } 64 }
65 65
66 function is_git_clone_repo {
67 "$GIT" config remote.origin.fetch > /dev/null
68 }
69
70 function update_git_repo {
71 if is_git_clone_repo; then
72 git fetch -q origin > /dev/null
73 git rebase -q origin > /dev/null
74 return 0
75 fi
76
77 test_git_svn
78 # work around a git-svn --quiet bug
79 OUTPUT=`"$GIT" svn rebase -q -q`
80 if [[ ! "$OUTPUT" == *Current.branch* ]]; then
81 echo $OUTPUT 1>&2
82 fi
83 return 0
84 }
85
66 # Get the current SVN revision. 86 # Get the current SVN revision.
67 get_svn_revision() { 87 get_svn_revision() {
68 LANGUAGE=C "$SVN" info "$base_dir" | \ 88 LANGUAGE=C "$SVN" info "$base_dir" | \
69 awk -F': ' '{ if ($1 == "Last Changed Rev") { print $2 }}' 89 awk -F': ' '{ if ($1 == "Last Changed Rev") { print $2 }}'
70 } 90 }
71 91
72 # Update git checkouts. 92 # Update git checkouts.
73 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.git" ] 93 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.git" ]
74 then 94 then
75 cd $base_dir 95 cd $base_dir
76 test_git_svn 96 update_git_repo
77 # work around a git-svn --quiet bug
78 OUTPUT=`"$GIT" svn rebase -q -q`
79 if [[ ! "$OUTPUT" == *Current.branch* ]]; then
80 echo $OUTPUT 1>&2
81 fi
82 cd - > /dev/null 97 cd - > /dev/null
83 fi 98 fi
84 99
85 # We're on POSIX. We can now safely look for svn checkout. 100 # We're on POSIX. We can now safely look for svn checkout.
86 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.svn" ] 101 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.svn" ]
87 then 102 then
88 # Update the root directory to stay up-to-date with the latest depot_tools. 103 # Update the root directory to stay up-to-date with the latest depot_tools.
89 BEFORE_REVISION=$(get_svn_revision) 104 BEFORE_REVISION=$(get_svn_revision)
90 "$SVN" -q up "$base_dir" 105 "$SVN" -q up "$base_dir"
91 AFTER_REVISION=$(get_svn_revision) 106 AFTER_REVISION=$(get_svn_revision)
92 if [[ "$BEFORE_REVISION" != "$AFTER_REVISION" ]]; then 107 if [[ "$BEFORE_REVISION" != "$AFTER_REVISION" ]]; then
93 echo "Depot Tools has been updated to revision $AFTER_REVISION." 1>&2 108 echo "Depot Tools has been updated to revision $AFTER_REVISION." 1>&2
94 fi 109 fi
95 fi 110 fi
96 111
97 find "$base_dir" -iname "*.pyc" -exec rm {} \; 112 find "$base_dir" -iname "*.pyc" -exec rm {} \;
OLDNEW
« no previous file with comments | « no previous file | update_depot_tools.bat » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698