OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
| 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 |
| 5 # found in the LICENSE file. |
| 6 |
3 # Abort on error. | 7 # Abort on error. |
4 set -e | 8 set -e |
5 | 9 |
6 export DEPOT_TOOLS_UPDATE=0 | 10 export DEPOT_TOOLS_UPDATE=0 |
7 | 11 |
8 PWD=`pwd` | 12 PWD=`pwd` |
9 REPO_URL=file://$PWD/svnrepo | 13 REPO_URL=file://$PWD/svnrepo |
10 TRUNK_URL=$REPO_URL/trunk | 14 TRUNK_URL=$REPO_URL/trunk |
11 BRANCH_URL=$REPO_URL/branches/some_branch | 15 BRANCH_URL=$REPO_URL/branches/some_branch |
12 GITREPO_PATH=$PWD/gitrepo | 16 GITREPO_PATH=$PWD/gitrepo |
(...skipping 26 matching lines...) Expand all Loading... |
39 | 43 |
40 # Set up a git-svn checkout of the repo. | 44 # Set up a git-svn checkout of the repo. |
41 setup_gitsvn() { | 45 setup_gitsvn() { |
42 echo "Setting up test git-svn repo..." | 46 echo "Setting up test git-svn repo..." |
43 rm -rf git-svn | 47 rm -rf git-svn |
44 # 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 |
45 # redirect its output. | 49 # redirect its output. |
46 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 |
47 } | 51 } |
48 | 52 |
| 53 # Set up a git-svn checkout of the repo and apply merge commits |
| 54 # (like the submodule repo layout). |
| 55 setup_gitsvn_submodule() { |
| 56 echo "Setting up test remote git-svn-submodule repo..." |
| 57 rm -rf git-svn-submodule |
| 58 git svn -q clone -s $REPO_URL git-svn-submodule >/dev/null 2>&1 |
| 59 svn_revision=`svn info file://$PWD/svnrepo | grep ^Revision | \ |
| 60 sed s/^.*:// | xargs` |
| 61 ( |
| 62 cd git-svn-submodule |
| 63 echo 'merge-file line 1' > merge-file |
| 64 git add merge-file; git commit -q -m 'First non-svn commit on master' |
| 65 git checkout -q refs/remotes/trunk |
| 66 git merge -q --no-commit --no-ff refs/heads/master >/dev/null 2>&1 |
| 67 echo 'merge-edit-file line 1' > merge-edit-file |
| 68 git add merge-edit-file |
| 69 git commit -q -m "SVN changes up to revision $svn_revision" |
| 70 git update-ref refs/heads/master HEAD |
| 71 git checkout master |
| 72 ) |
| 73 } |
| 74 |
49 # Set up a git repo that has a few commits to master. | 75 # Set up a git repo that has a few commits to master. |
50 setup_initgit() { | 76 setup_initgit() { |
51 echo "Setting up test upstream git repo..." | 77 echo "Setting up test upstream git repo..." |
52 rm -rf gitrepo | 78 rm -rf gitrepo |
53 mkdir gitrepo | 79 mkdir gitrepo |
54 | 80 |
55 ( | 81 ( |
56 cd gitrepo | 82 cd gitrepo |
57 git init -q | 83 git init -q |
58 echo "test" > test | 84 echo "test" > test |
59 git add test | 85 git add test |
60 git commit -qam "initial commit" | 86 git commit -qam "initial commit" |
61 echo "test2" >> test | 87 echo "test2" >> test |
62 git commit -qam "second commit" | 88 git commit -qam "second commit" |
63 # Hack: make sure master is not the current branch | 89 # Hack: make sure master is not the current branch |
64 # otherwise push will give a warning | 90 # otherwise push will give a warning |
65 git checkout -q -b foo | 91 git checkout -q -b foo |
66 ) | 92 ) |
67 } | 93 } |
68 | 94 |
69 # Set up a git checkout of the repo. | 95 # Set up a git checkout of the repo. |
70 setup_gitgit() { | 96 setup_gitgit() { |
71 echo "Setting up test git repo..." | 97 echo "Setting up test git repo..." |
72 rm -rf git-git | 98 rm -rf git-git |
73 git clone -q $GITREPO_URL git-git | 99 git clone -q $GITREPO_URL git-git |
74 } | 100 } |
75 | 101 |
76 cleanup() { | 102 cleanup() { |
77 rm -rf gitrepo svnrepo svn git-git git-svn | 103 rm -rf gitrepo svnrepo svn git-git git-svn git-svn-submodule |
78 } | 104 } |
79 | 105 |
80 # Usage: test_expect_success "description of test" "test code". | 106 # Usage: test_expect_success "description of test" "test code". |
81 test_expect_success() { | 107 test_expect_success() { |
82 echo "TESTING: $1" | 108 echo "TESTING: $1" |
83 exit_code=0 | 109 exit_code=0 |
84 sh -c "$2" || exit_code=$? | 110 sh -c "$2" || exit_code=$? |
85 if [ $exit_code != 0 ]; then | 111 if [ $exit_code != 0 ]; then |
86 echo "FAILURE: $1" | 112 echo "FAILURE: $1" |
87 return $exit_code | 113 return $exit_code |
(...skipping 10 matching lines...) Expand all Loading... |
98 return $exit_code | 124 return $exit_code |
99 fi | 125 fi |
100 } | 126 } |
101 | 127 |
102 # Grab the XSRF token from the review server and print it to stdout. | 128 # Grab the XSRF token from the review server and print it to stdout. |
103 print_xsrf_token() { | 129 print_xsrf_token() { |
104 curl --cookie dev_appserver_login="test@example.com:False" \ | 130 curl --cookie dev_appserver_login="test@example.com:False" \ |
105 --header 'X-Requesting-XSRF-Token: 1' \ | 131 --header 'X-Requesting-XSRF-Token: 1' \ |
106 http://localhost:8080/xsrf_token 2>/dev/null | 132 http://localhost:8080/xsrf_token 2>/dev/null |
107 } | 133 } |
OLD | NEW |