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

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: 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') | update_depot_tools.bat » ('J')
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 GITCONFIG="$("$GIT" config remote.origin.fetch > /dev/null)"
68 GITCONFIG_RC="$?"
69 if [ "$GITCONFIG_RC" == "0" ]
70 then
71 return 0
72 fi
73 return 1
74 }
75
76 function update_git_repo {
77 if is_git_clone_repo
M-A Ruel 2012/04/29 00:56:01 the rest of the file uses the style: "if is_git_cl
cmp 2012/04/30 03:16:16 Done. When writing this, I saw: if ...; then if
78 then
79 git fetch -q origin
80 git rebase -q origin
81 return 0
82 fi
83
84 test_git_svn
85 # work around a git-svn --quiet bug
86 OUTPUT=`"$GIT" svn rebase -q -q`
87 if [[ ! "$OUTPUT" == *Current.branch* ]]; then
88 echo $OUTPUT 1>&2
89 fi
90 return 0
91 }
92
66 # Get the current SVN revision. 93 # Get the current SVN revision.
67 get_svn_revision() { 94 get_svn_revision() {
68 LANGUAGE=C "$SVN" info "$base_dir" | \ 95 LANGUAGE=C "$SVN" info "$base_dir" | \
69 awk -F': ' '{ if ($1 == "Last Changed Rev") { print $2 }}' 96 awk -F': ' '{ if ($1 == "Last Changed Rev") { print $2 }}'
70 } 97 }
71 98
72 # Update git checkouts. 99 # Update git checkouts.
73 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.git" ] 100 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.git" ]
74 then 101 then
75 cd $base_dir 102 cd $base_dir
76 test_git_svn 103 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 104 cd - > /dev/null
83 fi 105 fi
84 106
85 # We're on POSIX. We can now safely look for svn checkout. 107 # We're on POSIX. We can now safely look for svn checkout.
86 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.svn" ] 108 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.svn" ]
87 then 109 then
88 # Update the root directory to stay up-to-date with the latest depot_tools. 110 # Update the root directory to stay up-to-date with the latest depot_tools.
89 BEFORE_REVISION=$(get_svn_revision) 111 BEFORE_REVISION=$(get_svn_revision)
90 "$SVN" -q up "$base_dir" 112 "$SVN" -q up "$base_dir"
91 AFTER_REVISION=$(get_svn_revision) 113 AFTER_REVISION=$(get_svn_revision)
92 if [[ "$BEFORE_REVISION" != "$AFTER_REVISION" ]]; then 114 if [[ "$BEFORE_REVISION" != "$AFTER_REVISION" ]]; then
93 echo "Depot Tools has been updated to revision $AFTER_REVISION." 1>&2 115 echo "Depot Tools has been updated to revision $AFTER_REVISION." 1>&2
94 fi 116 fi
95 fi 117 fi
96 118
97 find "$base_dir" -iname "*.pyc" -exec rm {} \; 119 find "$base_dir" -iname "*.pyc" -exec rm {} \;
OLDNEW
« no previous file with comments | « no previous file | update_depot_tools.bat » ('j') | update_depot_tools.bat » ('J')

Powered by Google App Engine
This is Rietveld 408576698