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