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

Side by Side Diff: create-chromium-git-src

Issue 267059: Make svn password prompt available during setup.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 11 years, 2 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 | no next file » | 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 -e 1 #!/bin/bash -e
2 # 2 #
3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 # 6 #
7 # create-chromium-git-src 7 # create-chromium-git-src
8 # 8 #
9 # Create and configure a local Chromium git repository. 9 # Create and configure a local Chromium git repository.
10 # 10 #
11 11
12 GITSERVER="${GITSERVER:-git.chromium.org}" 12 GITSERVER="${GITSERVER:-git.chromium.org}"
13 SVNSERVER="${SVNSERVER:-svn://svn.chromium.org/chrome}"
13 TMP=".create_chromium_git_src.$$" 14 TMP=".create_chromium_git_src.$$"
14 15
15 function cleanup { 16 function cleanup {
16 rm -rf "${TMP}" 17 rm -rf "${TMP}"
17 } 18 }
18 19
19 trap 'cleanup; echo Failure!; tput bel; exit 1' TERM QUIT HUP INT EXIT 20 trap 'cleanup; echo Failure!; tput bel; exit 1' TERM QUIT HUP INT EXIT
20 21
21 function get_email { 22 function get_email {
22 # Get user email address. 23 # Get user email address.
(...skipping 15 matching lines...) Expand all
38 function check_dirs { 39 function check_dirs {
39 if [ -d src ]; then 40 if [ -d src ]; then
40 echo "Found a src directory, do you already have a Chromium checkout?" 41 echo "Found a src directory, do you already have a Chromium checkout?"
41 exit 1 42 exit 1
42 fi 43 fi
43 } 44 }
44 45
45 # Test git and git --version. 46 # Test git and git --version.
46 function test_git { 47 function test_git {
47 echo -n "Trying git... " 48 echo -n "Trying git... "
48 local GITV="$(git --version 2>&1)" || { 49 local GITV="$(git --version)" || {
49 echo "git isn't installed, please install it" 50 echo "git isn't installed, please install it"
50 exit 1 51 exit 1
51 } 52 }
52 53
53 GITV="${GITV##* }" # Only examine last word (i.e. version number) 54 GITV="${GITV##* }" # Only examine last word (i.e. version number)
54 local GITD=( ${GITV//./ } ) # Split version number into decimals 55 local GITD=( ${GITV//./ } ) # Split version number into decimals
55 if ((GITD[0] < 1 || (GITD[0] == 1 && GITD[1] < 6) )); then 56 if ((GITD[0] < 1 || (GITD[0] == 1 && GITD[1] < 6) )); then
56 echo FAIL
57 echo "git version is ${GITV}, please update to a version later than 1.6" 57 echo "git version is ${GITV}, please update to a version later than 1.6"
58 exit 1 58 exit 1
59 fi 59 fi
60 echo OK 60 echo "found git version ${GITV}"
61 } 61 }
62 62
63 # Test git svn and git svn --version. 63 # Test git svn and git svn --version.
64 function test_git_svn { 64 function test_git_svn {
65 echo -n "Trying git-svn... " 65 echo -n "Trying git-svn... "
66 rm -rf "${TMP}" 66 rm -rf "${TMP}"
67 git clone git://github.com/git/hello-world.git "${TMP}" &>/dev/null && 67 git clone git://github.com/git/hello-world.git "${TMP}" &>/dev/null &&
68 local GITV="$(cd "${TMP}" && git svn --version 2>/dev/null)" || { 68 local GITV="$(cd "${TMP}" && git svn --version)" || {
69 echo FAIL
70 echo "git-svn isn't installed, please install it" 69 echo "git-svn isn't installed, please install it"
71 exit 1 70 exit 1
72 } 71 }
73 72
74 GITV="${GITV#* version }" # git svn --version has extra output to remove. 73 GITV="${GITV#* version }" # git svn --version has extra output to remove.
75 GITV="${GITV% (svn*}" 74 GITV="${GITV% (svn*}"
76 local GITD=( ${GITV//./ } ) # Split version number into decimals 75 local GITD=( ${GITV//./ } ) # Split version number into decimals
77 if ((GITD[0] < 1 || (GITD[0] == 1 && GITD[1] < 6) )); then 76 if ((GITD[0] < 1 || (GITD[0] == 1 && GITD[1] < 6) )); then
78 echo FAIL
79 echo "git version is ${GITV}, please update to a version later than 1.6" 77 echo "git version is ${GITV}, please update to a version later than 1.6"
80 exit 1 78 exit 1
81 fi 79 fi
82 echo OK 80 echo "found git-svn version ${GITV}"
81
82 echo "Testing git svn init..."
83 (cd "${TMP}" && git svn init --username="${EMAIL}" --prefix=origin/ \
M-A Ruel 2009/10/12 22:09:02 why not svn ls?
chase 2009/10/20 20:05:14 Tried in an earlier version, couldn't get the exac
84 -T trunk/src "${SVNSERVER}") &
85 local pid="$!"
86 { sleep 10 && kill "${pid}"; } &>/dev/null &
87 wait "${pid}" &>/dev/null || {
88 echo "Could not initialize repository, is SVN server ${SVNSERVER} correct?"
89 echo "The supplied username and password may be incorrect."
90 exit 1
91 }
83 } 92 }
84 93
85 # Verify we can reach our main git URL. 94 # Verify we can reach our main git URL.
86 function test_git_url { 95 function test_git_url {
87 echo -n "Testing Chromium git URL... " 96 echo -n "Testing Chromium git URL... "
88 mkdir -p "${TMP}" 97 mkdir -p "${TMP}"
89 (cd "${TMP}" && 98 (cd "${TMP}" &&
90 rm -rf .git .gitignore && 99 rm -rf .git .gitignore &&
91 git init && 100 git init &&
92 git remote add origin git://"${GITSERVER}"/chromium.git && 101 git remote add origin git://"${GITSERVER}"/chromium.git &&
93 git remote show origin) &>/dev/null & 102 git remote show origin) &>/dev/null &
94 local pid=$! 103 local pid="$!"
95 { sleep 10 && kill "${pid}"; } &>/dev/null & 104 { sleep 10 && kill "${pid}"; } &>/dev/null &
96 wait "${pid}" &>/dev/null || { 105 wait "${pid}" &>/dev/null || {
97 echo FAIL 106 echo "timeout accessing Chromium git URL, is ${GITSERVER} correct?"
98 echo "Timeout accessing Chromium git URL, is ${GITSERVER} correct?"
99 exit 1 107 exit 1
100 } 108 }
101 echo OK 109 echo OK
102 } 110 }
103 111
104 # Grab a clone of the Chromium git repository. 112 # Grab a clone of the Chromium git repository.
105 function grab_crgit { 113 function cr_git_clone {
106 echo "Grabbing Chromium git repository..." 114 echo "Grabbing Chromium git repository..."
107 git clone git://"${GITSERVER}"/chromium.git src || { 115 git clone git://"${GITSERVER}"/chromium.git src || {
108 echo "git clone exited with error" 116 echo "git clone exited with error"
109 echo "You should probably remove 'src' before retrying" 117 echo "You should probably remove 'src' before retrying"
110 exit 1 118 exit 1
111 } 119 }
112 } 120 }
113 121
114 # Configure the git repository to know about the upstream SVN server. 122 # Configure the git repository to know about the upstream SVN server.
115 function git_svn_init { 123 function cr_git_svn_init {
116 echo -n "Configuring upstream SVN... " 124 echo "Configuring upstream SVN..."
117 (cd src && git svn init --prefix=origin/ -T trunk/src \ 125 (cd src && git svn init --username="${EMAIL}" --prefix=origin/ -T trunk/src \
118 svn://svn.chromium.org/chrome) &>/dev/null || { 126 "${SVNSERVER}") || {
119 echo FAIL
120 echo "'git svn init' exited with error" 127 echo "'git svn init' exited with error"
121 exit 1 128 exit 1
122 } 129 }
123 echo OK
124 } 130 }
125 131
126 # Initialize the SVN history in the repository, also sanity checks our upstream 132 # Initialize the SVN history in the repository, also sanity checks our upstream
127 # SVN configuration. 133 # SVN configuration.
128 function git_svn_fetch { 134 function cr_git_svn_fetch {
129 echo "Fetching SVN history..." 135 echo "Fetching SVN history..."
130 (cd src && git svn fetch && git pull) || { 136 (cd src && git svn fetch && git pull) || {
131 echo "'git svn fetch' exited with error" 137 echo "'git svn fetch' exited with error"
132 exit 1 138 exit 1
133 } 139 }
134 } 140 }
135 141
136 # Remaining configuration of the git repository: 142 # Remaining configuration of the git repository:
137 # - associate with codereview/rietveld 143 # - associate with codereview/rietveld
138 # - set the repository's email address 144 # - set the repository's email address
139 # - disable crlf munging 145 # - disable crlf munging
140 # - grab a stock .gclient file 146 # - grab a stock .gclient file
141 function git_config { 147 function git_config {
142 echo -n "Associating with Rietveld... " 148 echo -n "Associating with Rietveld... "
143 (cd src && git cl config http://src.chromium.org/svn/) 149 (cd src && git cl config http://src.chromium.org/svn/)
144 echo OK 150 echo OK
145 151
146 echo -n "Configuring email address (git config user.email ${EMAIL})... " 152 echo -n "Configuring email address... "
147 (cd src && git config user.email "${EMAIL}") 153 (cd src && git config user.email "${EMAIL}")
148 echo OK 154 echo OK
149 155
150 echo -n "Disabling crlf munging... " 156 echo -n "Disabling crlf munging... "
151 (cd src && git config --global core.autocrlf false) 157 (cd src && git config --global core.autocrlf false)
152 echo OK 158 echo OK
153 159
154 echo -n "Creating a .gclient file... " 160 echo -n "Creating a .gclient file... "
155 gclient config http://src.chromium.org/svn/trunk/src 161 gclient config http://src.chromium.org/svn/trunk/src
156 echo OK 162 echo OK
157 } 163 }
158 164
159 get_email 165 get_email
160 check_dirs 166 check_dirs
161 test_git 167 test_git
162 test_git_svn 168 test_git_svn
163 test_git_url 169 test_git_url
164 grab_crgit 170 cr_git_clone
165 git_svn_init 171 cr_git_svn_init
166 git_svn_fetch 172 cr_git_svn_fetch
167 git_config 173 git_config
168 174
169 echo 175 echo
170 echo "A Chromium Git repository was created in 'src'." 176 echo "A Chromium Git repository was created in 'src'."
171 echo 177 echo
172 echo " To create a CL..." 178 echo " To create a CL..."
173 echo " Update: git pull && gclient sync" 179 echo " Update: git pull && gclient sync"
174 echo " Create and use a branch mychange: git checkout -q -b mychange origin" 180 echo " Create and use a branch mychange: git checkout -q -b mychange origin"
175 echo " Edit files and commit: git commit -a -v" 181 echo " Edit files and commit: git commit -a -v"
176 echo " Upload CL: git cl upload" 182 echo " Upload CL: git cl upload"
177 echo " Try a change: git try origin" 183 echo " Try a change: git try origin"
178 echo " Commit a CL: git cl dcommit" 184 echo " Commit a CL: git cl dcommit"
179 echo " Switch to the trunk: git checkout trunk" 185 echo " Switch to the trunk: git checkout trunk"
180 echo " Delete a branch mychange: git branch -d mychange" 186 echo " Delete a branch mychange: git branch -d mychange"
181 echo 187 echo
182 echo " If while on a branch you need to switch back to the trunk..." 188 echo " If while on a branch you need to switch back to the trunk..."
183 echo " Switch to the trunk: git checkout trunk" 189 echo " Switch to the trunk: git checkout trunk"
184 echo " List all branches: git branch" 190 echo " List all branches: git branch"
185 echo " Switch to branch mychange: git checkout mychange" 191 echo " Switch to branch mychange: git checkout mychange"
186 echo 192 echo
187 echo " Examining files and changes..." 193 echo " Examining files and changes..."
188 echo " Log with patches: git log -p" 194 echo " Log with patches: git log -p"
189 echo " Changes to DEPS: git log -p DEPS" 195 echo " Changes to DEPS: git log -p DEPS"
190 echo " View latest commit: git cat-file commit HEAD" 196 echo " View latest commit: git cat-file commit HEAD"
191 echo 197 echo
192 echo "You should run: gclient sync" 198 echo "You should run: gclient sync"
193 echo 199 echo
194 trap cleanup EXIT 200 trap cleanup EXIT
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698