| OLD | NEW |
| 1 #!/usr/bin/env bash | 1 #!/usr/bin/env 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 |
| 11 | 11 |
| 12 PWD=`pwd` | 12 PWD=$(pwd) |
| 13 REPO_URL=file://$PWD/svnrepo | 13 REPO_URL=file://$PWD/svnrepo |
| 14 TRUNK_URL=$REPO_URL/trunk | 14 TRUNK_URL=$REPO_URL/trunk |
| 15 BRANCH_URL=$REPO_URL/branches/some_branch | 15 BRANCH_URL=$REPO_URL/branches/some_branch |
| 16 GITREPO_PATH=$PWD/gitrepo | 16 GITREPO_PATH=$PWD/gitrepo |
| 17 GITREPO_URL=file://$GITREPO_PATH | 17 GITREPO_URL=file://$GITREPO_PATH |
| 18 PATH="$PWD/..:$PATH" | 18 PATH="$(dirname $PWD):$PATH" |
| 19 GIT_CL=$PWD/../git-cl | 19 GIT_CL=$(dirname $PWD)/git-cl |
| 20 GIT_CL_STATUS="$GIT_CL status -f" | 20 GIT_CL_STATUS="$GIT_CL status -f" |
| 21 | 21 |
| 22 # Set up an SVN repo that has a few commits to trunk. | 22 # Set up an SVN repo that has a few commits to trunk. |
| 23 setup_initsvn() { | 23 setup_initsvn() { |
| 24 echo "Setting up test SVN repo..." | 24 echo "Setting up test SVN repo..." |
| 25 rm -rf svnrepo | 25 rm -rf svnrepo |
| 26 svnadmin create svnrepo | 26 svnadmin create svnrepo |
| 27 # Need this in order for Mac SnowLeopard to work | 27 # Need this in order for Mac SnowLeopard to work |
| 28 echo "enable-rep-sharing = false" >> svnrepo/db/fsfs.conf | 28 echo "enable-rep-sharing = false" >> svnrepo/db/fsfs.conf |
| 29 | 29 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 42 | 42 |
| 43 svn cp -q -m 'branching' --parents $TRUNK_URL $BRANCH_URL | 43 svn cp -q -m 'branching' --parents $TRUNK_URL $BRANCH_URL |
| 44 } | 44 } |
| 45 | 45 |
| 46 # Set up a git-svn checkout of the repo. | 46 # Set up a git-svn checkout of the repo. |
| 47 setup_gitsvn() { | 47 setup_gitsvn() { |
| 48 echo "Setting up test git-svn repo..." | 48 echo "Setting up test git-svn repo..." |
| 49 rm -rf git-svn | 49 rm -rf git-svn |
| 50 # There appears to be no way to make git-svn completely shut up, so we | 50 # There appears to be no way to make git-svn completely shut up, so we |
| 51 # redirect its output. | 51 # redirect its output. |
| 52 # clone with --prefix origin/ to ensure the same behaviour with old and new |
| 53 # versions of git (The default prefix was "" prior to Git 2.0) |
| 52 git svn --prefix origin/ -q clone -s $REPO_URL git-svn >/dev/null 2>&1 | 54 git svn --prefix origin/ -q clone -s $REPO_URL git-svn >/dev/null 2>&1 |
| 53 ( | 55 ( |
| 54 cd git-svn | 56 cd git-svn |
| 55 git remote add origin https://example.com/fake_refspec | 57 git remote add origin https://example.com/fake_refspec |
| 56 git config user.name 'TestDood' | 58 git config user.name 'TestDood' |
| 57 git config user.email 'TestDood@example.com' | 59 git config user.email 'TestDood@example.com' |
| 58 ) | 60 ) |
| 59 } | 61 } |
| 60 | 62 |
| 61 # Set up a git-svn checkout of the repo and apply merge commits | 63 # Set up a git-svn checkout of the repo and apply merge commits |
| 62 # (like the submodule repo layout). | 64 # (like the submodule repo layout). |
| 63 setup_gitsvn_submodule() { | 65 setup_gitsvn_submodule() { |
| 64 echo "Setting up test remote git-svn-submodule repo..." | 66 echo "Setting up test remote git-svn-submodule repo..." |
| 65 rm -rf git-svn-submodule | 67 rm -rf git-svn-submodule |
| 66 git svn -q clone -s $REPO_URL git-svn-submodule >/dev/null 2>&1 | 68 # clone with --prefix origin/ to ensure the same behaviour with old and new |
| 69 # versions of git (The default prefix was "" prior to Git 2.0) |
| 70 git svn --prefix origin/ -q clone -s $REPO_URL git-svn-submodule >/dev/null 2>
&1 |
| 67 svn_revision=`svn info file://$PWD/svnrepo | grep ^Revision | \ | 71 svn_revision=`svn info file://$PWD/svnrepo | grep ^Revision | \ |
| 68 sed s/^.*:// | xargs` | 72 sed s/^.*:// | xargs` |
| 69 ( | 73 ( |
| 70 cd git-svn-submodule | 74 cd git-svn-submodule |
| 71 git config user.name 'TestDood' | 75 git config user.name 'TestDood' |
| 72 git config user.email 'TestDood@example.com' | 76 git config user.email 'TestDood@example.com' |
| 73 echo 'merge-file line 1' > merge-file | 77 echo 'merge-file line 1' > merge-file |
| 74 git add merge-file; git commit -q -m 'First non-svn commit on master' | 78 git add merge-file; git commit -q -m 'First non-svn commit on master' |
| 75 git checkout -q refs/remotes/trunk | 79 git checkout -q refs/remotes/origin/trunk |
| 76 git merge -q --no-commit --no-ff refs/heads/master >/dev/null 2>&1 | 80 git merge -q --no-commit --no-ff refs/heads/master >/dev/null 2>&1 |
| 77 echo 'merge-edit-file line 1' > merge-edit-file | 81 echo 'merge-edit-file line 1' > merge-edit-file |
| 78 git add merge-edit-file | 82 git add merge-edit-file |
| 79 git commit -q -m "SVN changes up to revision $svn_revision" | 83 git commit -q -m "SVN changes up to revision $svn_revision" |
| 80 git update-ref refs/heads/master HEAD | 84 git update-ref refs/heads/master HEAD |
| 81 git checkout master | 85 git checkout master |
| 82 ) | 86 ) |
| 83 } | 87 } |
| 84 | 88 |
| 85 # Set up a git repo that has a few commits to master. | 89 # Set up a git repo that has a few commits to master. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 return $exit_code | 145 return $exit_code |
| 142 fi | 146 fi |
| 143 } | 147 } |
| 144 | 148 |
| 145 # Grab the XSRF token from the review server and print it to stdout. | 149 # Grab the XSRF token from the review server and print it to stdout. |
| 146 print_xsrf_token() { | 150 print_xsrf_token() { |
| 147 curl --cookie dev_appserver_login="test@example.com:False" \ | 151 curl --cookie dev_appserver_login="test@example.com:False" \ |
| 148 --header 'X-Requesting-XSRF-Token: 1' \ | 152 --header 'X-Requesting-XSRF-Token: 1' \ |
| 149 http://localhost:10000/xsrf_token 2>/dev/null | 153 http://localhost:10000/xsrf_token 2>/dev/null |
| 150 } | 154 } |
| OLD | NEW |