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

Side by Side Diff: tests/test-lib.sh

Issue 2394033003: Remove SVN (and dcommit) support from git-cl (Closed)
Patch Set: Rebase Created 4 years 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
« no previous file with comments | « tests/submodule-merge-test.sh ('k') | tests/upload-local-tracking-branch.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 export PYTHONUNBUFFERED= 11 export PYTHONUNBUFFERED=
12 12
13 PWD=$(pwd) 13 PWD=$(pwd)
14 REPO_URL=file://$PWD/svnrepo 14 GITREPO_PATH=$PWD/git_remote
15 TRUNK_URL=$REPO_URL/trunk
16 BRANCH_URL=$REPO_URL/branches/some_branch
17 GITREPO_PATH=$PWD/gitrepo
18 GITREPO_URL=file://$GITREPO_PATH 15 GITREPO_URL=file://$GITREPO_PATH
19 PATH="$(dirname $PWD):$PATH" 16 PATH="$(dirname $PWD):$PATH"
20 GIT_CL=$(dirname $PWD)/git-cl 17 GIT_CL=$(dirname $PWD)/git-cl
21 GIT_CL_STATUS="$GIT_CL status -f" 18 GIT_CL_STATUS="$GIT_CL status -f"
22 19
23 # Set up an SVN repo that has a few commits to trunk.
24 setup_initsvn() {
25 echo "Setting up test SVN repo..."
26 rm -rf svnrepo
27 svnadmin create svnrepo
28 # Need this in order for Mac SnowLeopard to work
29 echo "enable-rep-sharing = false" >> svnrepo/db/fsfs.conf
30
31 svn mkdir -q -m 'creating trunk' --parents $TRUNK_URL
32
33 rm -rf svn
34 svn co -q $TRUNK_URL svn
35 (
36 cd svn
37 echo "test" > test
38 svn add -q test
39 svn commit -q -m "initial commit"
40 echo "test2" >> test
41 svn commit -q -m "second commit"
42 )
43
44 svn cp -q -m 'branching' --parents $TRUNK_URL $BRANCH_URL
45 }
46
47 # Set up a git-svn checkout of the repo.
48 setup_gitsvn() {
49 echo "Setting up test git-svn repo..."
50 rm -rf git-svn
51 # There appears to be no way to make git-svn completely shut up, so we
52 # redirect its output.
53 # clone with --prefix origin/ to ensure the same behaviour with old and new
54 # versions of git (The default prefix was "" prior to Git 2.0)
55 git svn --prefix origin/ -q clone -s $REPO_URL git-svn >/dev/null 2>&1
56 (
57 cd git-svn
58 git remote add origin https://example.com/fake_refspec
59 git config user.name 'TestDood'
60 git config user.email 'TestDood@example.com'
61 )
62 }
63
64 # Set up a git-svn checkout of the repo and apply merge commits
65 # (like the submodule repo layout).
66 setup_gitsvn_submodule() {
67 echo "Setting up test remote git-svn-submodule repo..."
68 rm -rf git-svn-submodule
69 # clone with --prefix origin/ to ensure the same behaviour with old and new
70 # versions of git (The default prefix was "" prior to Git 2.0)
71 git svn --prefix origin/ -q clone -s $REPO_URL git-svn-submodule >/dev/null 2> &1
72 svn_revision=`svn info file://$PWD/svnrepo | grep ^Revision | \
73 sed s/^.*:// | xargs`
74 (
75 cd git-svn-submodule
76 git config user.name 'TestDood'
77 git config user.email 'TestDood@example.com'
78 echo 'merge-file line 1' > merge-file
79 git add merge-file; git commit -q -m 'First non-svn commit on master'
80 git checkout -q refs/remotes/origin/trunk
81 git merge -q --no-commit --no-ff refs/heads/master >/dev/null 2>&1
82 echo 'merge-edit-file line 1' > merge-edit-file
83 git add merge-edit-file
84 git commit -q -m "SVN changes up to revision $svn_revision"
85 git update-ref refs/heads/master HEAD
86 git checkout master
87 )
88 }
89
90 # Set up a git repo that has a few commits to master. 20 # Set up a git repo that has a few commits to master.
91 setup_initgit() { 21 setup_git_remote() {
92 echo "Setting up test upstream git repo..." 22 echo "Setting up test upstream git repo..."
93 rm -rf gitrepo 23 rm -rf git_remote
94 mkdir gitrepo 24 mkdir git_remote
95 25
96 ( 26 (
97 cd gitrepo 27 cd git_remote
98 git init -q 28 git init -q
99 git config user.name 'TestDood' 29 git config user.name 'TestDood'
100 git config user.email 'TestDood@example.com' 30 git config user.email 'TestDood@example.com'
101 echo "test" > test 31 echo "test" > test
102 git add test 32 git add test
103 git commit -qam "initial commit" 33 git commit -qam "initial commit"
104 echo "test2" >> test 34 echo "test2" >> test
105 git commit -qam "second commit" 35 git commit -qam "second commit"
106 # Hack: make sure master is not the current branch 36 # Hack: make sure master is not the current branch
107 # otherwise push will give a warning 37 # otherwise push will give a warning
108 git checkout -q --detach master 38 git checkout -q --detach master
109 ) 39 )
110 } 40 }
111 41
112 # Set up a git checkout of the repo. 42 # Set up a git checkout of the repo.
113 setup_gitgit() { 43 setup_git_checkout() {
114 echo "Setting up test git repo..." 44 echo "Setting up test git repo..."
115 rm -rf git-git 45 rm -rf git_checkout
116 git clone -q $GITREPO_URL git-git 46 git clone -q $GITREPO_URL git_checkout
117 ( 47 (
118 cd git-git 48 cd git_checkout
119 git config user.name 'TestDood' 49 git config user.name 'TestDood'
120 git config user.email 'TestDood@example.com' 50 git config user.email 'TestDood@example.com'
121 ) 51 )
122 } 52 }
123 53
124 cleanup() { 54 cleanup() {
125 rm -rf gitrepo svnrepo svn git-git git-svn git-svn-submodule 55 rm -rf git_remote git_checkout
126 } 56 }
127 57
128 # Usage: test_expect_success "description of test" "test code". 58 # Usage: test_expect_success "description of test" "test code".
129 test_expect_success() { 59 test_expect_success() {
130 echo "TESTING: $1" 60 echo "TESTING: $1"
131 exit_code=0 61 exit_code=0
132 sh -c "$2" || exit_code=$? 62 sh -c "$2" || exit_code=$?
133 if [ $exit_code != 0 ]; then 63 if [ $exit_code != 0 ]; then
134 echo "FAILURE: $1" 64 echo "FAILURE: $1"
135 return $exit_code 65 return $exit_code
(...skipping 10 matching lines...) Expand all
146 return $exit_code 76 return $exit_code
147 fi 77 fi
148 } 78 }
149 79
150 # Grab the XSRF token from the review server and print it to stdout. 80 # Grab the XSRF token from the review server and print it to stdout.
151 print_xsrf_token() { 81 print_xsrf_token() {
152 curl --cookie dev_appserver_login="test@example.com:False" \ 82 curl --cookie dev_appserver_login="test@example.com:False" \
153 --header 'X-Requesting-XSRF-Token: 1' \ 83 --header 'X-Requesting-XSRF-Token: 1' \
154 http://localhost:10000/xsrf_token 2>/dev/null 84 http://localhost:10000/xsrf_token 2>/dev/null
155 } 85 }
OLDNEW
« no previous file with comments | « tests/submodule-merge-test.sh ('k') | tests/upload-local-tracking-branch.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698