submodule-merge-test.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/usr/bin/env bash
  2. # Copyright (c) 2012 The Chromium Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. set -e
  6. . ./test-lib.sh
  7. setup_initsvn
  8. setup_gitsvn_submodule
  9. (
  10. set -e
  11. prev_svn_revision=`svn info file://$PWD/svnrepo | grep ^Revision | \
  12. sed s/^.*:// | xargs`
  13. cd git-svn-submodule
  14. git config rietveld.server localhost:1
  15. git checkout -q --track -b work
  16. echo "some work done" >> test
  17. git add test; git commit -q -m "work \
  18. TBR=foo"
  19. git_diff=`git diff HEAD^ | sed -n '/^@@/,$p' | xargs`
  20. test_expect_success "dcommitted code" \
  21. "$GIT_CL dcommit -f --bypass-hooks -m 'dcommit'"
  22. cd ..
  23. next_svn_revision=`svn info file://$PWD/svnrepo | grep ^Revision | \
  24. sed s/^.*:// | xargs`
  25. test_expect_success "svn got new revision" \
  26. "test $next_svn_revision = `expr $prev_svn_revision + 1`"
  27. svn_diff=`svn diff -c $next_svn_revision file://$PWD/svnrepo | \
  28. sed -n '/^@@/,$p' | xargs`
  29. test_expect_success "svn diff is correct" \
  30. "test \"$git_diff\" = \"$svn_diff\""
  31. cd git-svn-submodule
  32. git svn fetch
  33. last_svn_rev=`git show refs/remotes/trunk | grep git-svn-id: | \
  34. grep -o trunk@[0-9]* | xargs`
  35. test_expect_success "git svn fetch gets new svn revision" \
  36. "test $last_svn_rev = trunk@$next_svn_revision"
  37. )
  38. SUCCESS=$?
  39. #cleanup
  40. if [ $SUCCESS == 0 ]; then
  41. echo PASS
  42. fi