OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 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 # Abort on error. | 7 # Abort on error. |
8 set -e | 8 set -e |
9 | 9 |
10 export DEPOT_TOOLS_UPDATE=0 | 10 export DEPOT_TOOLS_UPDATE=0 |
(...skipping 30 matching lines...) Expand all Loading... |
41 svn cp -q -m 'branching' --parents $TRUNK_URL $BRANCH_URL | 41 svn cp -q -m 'branching' --parents $TRUNK_URL $BRANCH_URL |
42 } | 42 } |
43 | 43 |
44 # Set up a git-svn checkout of the repo. | 44 # Set up a git-svn checkout of the repo. |
45 setup_gitsvn() { | 45 setup_gitsvn() { |
46 echo "Setting up test git-svn repo..." | 46 echo "Setting up test git-svn repo..." |
47 rm -rf git-svn | 47 rm -rf git-svn |
48 # There appears to be no way to make git-svn completely shut up, so we | 48 # There appears to be no way to make git-svn completely shut up, so we |
49 # redirect its output. | 49 # redirect its output. |
50 git svn -q clone -s $REPO_URL git-svn >/dev/null 2>&1 | 50 git svn -q clone -s $REPO_URL git-svn >/dev/null 2>&1 |
| 51 ( |
| 52 cd git-svn |
| 53 git config user.name 'TestDood' |
| 54 git config user.email 'TestDood@example.com' |
| 55 ) |
51 } | 56 } |
52 | 57 |
53 # Set up a git-svn checkout of the repo and apply merge commits | 58 # Set up a git-svn checkout of the repo and apply merge commits |
54 # (like the submodule repo layout). | 59 # (like the submodule repo layout). |
55 setup_gitsvn_submodule() { | 60 setup_gitsvn_submodule() { |
56 echo "Setting up test remote git-svn-submodule repo..." | 61 echo "Setting up test remote git-svn-submodule repo..." |
57 rm -rf git-svn-submodule | 62 rm -rf git-svn-submodule |
58 git svn -q clone -s $REPO_URL git-svn-submodule >/dev/null 2>&1 | 63 git svn -q clone -s $REPO_URL git-svn-submodule >/dev/null 2>&1 |
59 svn_revision=`svn info file://$PWD/svnrepo | grep ^Revision | \ | 64 svn_revision=`svn info file://$PWD/svnrepo | grep ^Revision | \ |
60 sed s/^.*:// | xargs` | 65 sed s/^.*:// | xargs` |
61 ( | 66 ( |
62 cd git-svn-submodule | 67 cd git-svn-submodule |
| 68 git config user.name 'TestDood' |
| 69 git config user.email 'TestDood@example.com' |
63 echo 'merge-file line 1' > merge-file | 70 echo 'merge-file line 1' > merge-file |
64 git add merge-file; git commit -q -m 'First non-svn commit on master' | 71 git add merge-file; git commit -q -m 'First non-svn commit on master' |
65 git checkout -q refs/remotes/trunk | 72 git checkout -q refs/remotes/trunk |
66 git merge -q --no-commit --no-ff refs/heads/master >/dev/null 2>&1 | 73 git merge -q --no-commit --no-ff refs/heads/master >/dev/null 2>&1 |
67 echo 'merge-edit-file line 1' > merge-edit-file | 74 echo 'merge-edit-file line 1' > merge-edit-file |
68 git add merge-edit-file | 75 git add merge-edit-file |
69 git commit -q -m "SVN changes up to revision $svn_revision" | 76 git commit -q -m "SVN changes up to revision $svn_revision" |
70 git update-ref refs/heads/master HEAD | 77 git update-ref refs/heads/master HEAD |
71 git checkout master | 78 git checkout master |
72 ) | 79 ) |
73 } | 80 } |
74 | 81 |
75 # Set up a git repo that has a few commits to master. | 82 # Set up a git repo that has a few commits to master. |
76 setup_initgit() { | 83 setup_initgit() { |
77 echo "Setting up test upstream git repo..." | 84 echo "Setting up test upstream git repo..." |
78 rm -rf gitrepo | 85 rm -rf gitrepo |
79 mkdir gitrepo | 86 mkdir gitrepo |
80 | 87 |
81 ( | 88 ( |
82 cd gitrepo | 89 cd gitrepo |
83 git init -q | 90 git init -q |
| 91 git config user.name 'TestDood' |
| 92 git config user.email 'TestDood@example.com' |
84 echo "test" > test | 93 echo "test" > test |
85 git add test | 94 git add test |
86 git commit -qam "initial commit" | 95 git commit -qam "initial commit" |
87 echo "test2" >> test | 96 echo "test2" >> test |
88 git commit -qam "second commit" | 97 git commit -qam "second commit" |
89 # Hack: make sure master is not the current branch | 98 # Hack: make sure master is not the current branch |
90 # otherwise push will give a warning | 99 # otherwise push will give a warning |
91 git checkout -q -b foo | 100 git checkout -q -b foo |
92 ) | 101 ) |
93 } | 102 } |
94 | 103 |
95 # Set up a git checkout of the repo. | 104 # Set up a git checkout of the repo. |
96 setup_gitgit() { | 105 setup_gitgit() { |
97 echo "Setting up test git repo..." | 106 echo "Setting up test git repo..." |
98 rm -rf git-git | 107 rm -rf git-git |
99 git clone -q $GITREPO_URL git-git | 108 git clone -q $GITREPO_URL git-git |
| 109 ( |
| 110 cd git-git |
| 111 git config user.name 'TestDood' |
| 112 git config user.email 'TestDood@example.com' |
| 113 ) |
100 } | 114 } |
101 | 115 |
102 cleanup() { | 116 cleanup() { |
103 rm -rf gitrepo svnrepo svn git-git git-svn git-svn-submodule | 117 rm -rf gitrepo svnrepo svn git-git git-svn git-svn-submodule |
104 } | 118 } |
105 | 119 |
106 # Usage: test_expect_success "description of test" "test code". | 120 # Usage: test_expect_success "description of test" "test code". |
107 test_expect_success() { | 121 test_expect_success() { |
108 echo "TESTING: $1" | 122 echo "TESTING: $1" |
109 exit_code=0 | 123 exit_code=0 |
(...skipping 14 matching lines...) Expand all Loading... |
124 return $exit_code | 138 return $exit_code |
125 fi | 139 fi |
126 } | 140 } |
127 | 141 |
128 # Grab the XSRF token from the review server and print it to stdout. | 142 # Grab the XSRF token from the review server and print it to stdout. |
129 print_xsrf_token() { | 143 print_xsrf_token() { |
130 curl --cookie dev_appserver_login="test@example.com:False" \ | 144 curl --cookie dev_appserver_login="test@example.com:False" \ |
131 --header 'X-Requesting-XSRF-Token: 1' \ | 145 --header 'X-Requesting-XSRF-Token: 1' \ |
132 http://localhost:8080/xsrf_token 2>/dev/null | 146 http://localhost:8080/xsrf_token 2>/dev/null |
133 } | 147 } |
OLD | NEW |