OLD | NEW |
| (Empty) |
1 #!/usr/bin/env bash | |
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 | |
7 set -e | |
8 SCRIPT_DIR=$(cd $(dirname "$BASH_SOURCE") && pwd) | |
9 cd ${SCRIPT_DIR} | |
10 | |
11 . ./test-lib.sh | |
12 | |
13 setup_initsvn | |
14 setup_gitsvn_submodule | |
15 | |
16 ( | |
17 set -e | |
18 prev_svn_revision=`svn info file://$PWD/svnrepo | grep ^Revision | \ | |
19 sed s/^.*:// | xargs` | |
20 cd git-svn-submodule | |
21 git config rietveld.server localhost:1 | |
22 git checkout -q --track -b work | |
23 echo "some work done" >> test | |
24 git add test; git commit -q -m "work \ | |
25 TBR=foo" | |
26 | |
27 git_diff=`git diff HEAD^ | sed -n '/^@@/,$p' | xargs` | |
28 | |
29 test_expect_success "dcommitted code" \ | |
30 "$GIT_CL dcommit --no-oauth2 -f --bypass-hooks -m 'dcommit'" | |
31 | |
32 cd .. | |
33 | |
34 next_svn_revision=`svn info file://$PWD/svnrepo | grep ^Revision | \ | |
35 sed s/^.*:// | xargs` | |
36 | |
37 test_expect_success "svn got new revision" \ | |
38 "test $next_svn_revision = `expr $prev_svn_revision + 1`" | |
39 | |
40 svn_diff=`svn diff -c $next_svn_revision file://$PWD/svnrepo | \ | |
41 sed -n '/^@@/,$p' | xargs` | |
42 | |
43 test_expect_success "svn diff is correct" \ | |
44 "test \"$git_diff\" = \"$svn_diff\"" | |
45 | |
46 cd git-svn-submodule | |
47 git svn fetch | |
48 last_svn_rev=`git show refs/remotes/origin/trunk | grep git-svn-id: | \ | |
49 grep -o trunk@[0-9]* | xargs` | |
50 | |
51 test_expect_success "git svn fetch gets new svn revision" \ | |
52 "test $last_svn_rev = trunk@$next_svn_revision" | |
53 ) | |
54 SUCCESS=$? | |
55 | |
56 #cleanup | |
57 | |
58 if [ $SUCCESS == 0 ]; then | |
59 echo PASS | |
60 fi | |
OLD | NEW |