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

Side by Side Diff: gclient

Issue 518064: Check for the existence of git before running commands (Closed)
Patch Set: Fixed whitespace issues Created 10 years, 11 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
« no previous file with comments | « no previous file | gclient_scm.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2009 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 9
10 # Test git and git --version.
11 function test_git {
12 echo -n "Trying git... "
13 local GITV="$(git --version)" || {
14 echo "git isn't installed, please install it"
15 exit 1
16 }
17
18 GITV="${GITV##* }" # Only examine last word (i.e. version number)
19 local GITD=( ${GITV//./ } ) # Split version number into decimals
20 if ((GITD[0] < 1 || (GITD[0] == 1 && GITD[1] < 6) )); then
21 echo "git version is ${GITV}, please update to a version later than 1.6"
22 exit 1
23 fi
24 }
25
26 # Test git svn and git svn --version.
27 function test_git_svn {
28 echo -n "Trying git-svn... "
M-A Ruel 2010/01/08 01:12:43 Actually, after trying the patch, I don't want thi
29 local GITV="$(git svn --version)" || {
30 echo "git-svn isn't installed, please install it"
31 exit 1
32 }
33
34 GITV="${GITV#* version }" # git svn --version has extra output to remove.
35 GITV="${GITV% (svn*}"
36 local GITD=( ${GITV//./ } ) # Split version number into decimals
37 if ((GITD[0] < 1 || (GITD[0] == 1 && GITD[1] < 6) )); then
38 echo "git version is ${GITV}, please update to a version later than 1.6"
39 exit 1
40 fi
41 }
42
43
10 # Update git checkouts prior the cygwin check, we don't want to use msysgit. 44 # Update git checkouts prior the cygwin check, we don't want to use msysgit.
11 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.git" ] 45 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.git" ]
12 then 46 then
47 test_git_svn
13 (cd "$base_dir"; git svn rebase -q -q) 48 (cd "$base_dir"; git svn rebase -q -q)
14 fi 49 fi
15 50
16 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/git-cl-repo/.git" ] 51 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/git-cl-repo/.git" ]
17 then 52 then
53 test_git
18 (cd "$base_dir/git-cl-repo"; git pull -q) 54 (cd "$base_dir/git-cl-repo"; git pull -q)
19 fi 55 fi
20 56
21 # Use the batch file as an entry point if on cygwin. 57 # Use the batch file as an entry point if on cygwin.
22 if [ "${OSTYPE}" = "cygwin" -a "${TERM}" != "xterm" ]; then 58 if [ "${OSTYPE}" = "cygwin" -a "${TERM}" != "xterm" ]; then
23 ${base_dir}/gclient.bat "$@" 59 ${base_dir}/gclient.bat "$@"
24 exit 60 exit
25 fi 61 fi
26 62
27 63
28 # We're on POSIX (not cygwin). We can now safely look for svn checkout. 64 # We're on POSIX (not cygwin). We can now safely look for svn checkout.
29 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.svn" ] 65 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.svn" ]
30 then 66 then
31 # 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
32 # depot_tools. 68 # depot_tools.
33 svn -q up "$base_dir" 69 svn -q up "$base_dir"
34 fi 70 fi
35 71
36 exec python "$base_dir/gclient.py" "$@" 72 exec python "$base_dir/gclient.py" "$@"
OLDNEW
« no previous file with comments | « no previous file | gclient_scm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698