basic.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/bash
  2. set -e
  3. . ./test-lib.sh
  4. setup_initsvn
  5. setup_gitsvn
  6. (
  7. set -e
  8. cd git-svn
  9. git checkout -q -b work
  10. echo "some work done on a branch" >> test
  11. git add test; git commit -q -m "branch work"
  12. echo "some other work done on a branch" >> test
  13. git add test; git commit -q -m "branch work"
  14. test_expect_success "git-cl upload wants a server" \
  15. "$GIT_CL upload 2>&1 | grep -q 'You must configure'"
  16. git config rietveld.server localhost:8080
  17. test_expect_success "git-cl status has no issue" \
  18. "$GIT_CL status | grep -q 'no issue'"
  19. # Prevent the editor from coming up when you upload.
  20. export EDITOR=/bin/true
  21. test_expect_success "upload succeeds (needs a server running on localhost)" \
  22. "$GIT_CL upload -m test master... | grep -q 'Issue created'"
  23. test_expect_success "git-cl status now knows the issue" \
  24. "$GIT_CL status | grep -q 'Issue number'"
  25. # Push a description to this URL.
  26. URL=$($GIT_CL status | sed -ne '/Issue number/s/[^(]*(\(.*\))/\1/p')
  27. curl --cookie dev_appserver_login="test@example.com:False" \
  28. --data-urlencode subject="test" \
  29. --data-urlencode description="foo-quux" \
  30. $URL/edit
  31. test_expect_success "git-cl dcommits ok" \
  32. "$GIT_CL dcommit -f"
  33. git checkout -q master
  34. git svn -q rebase >/dev/null 2>&1
  35. test_expect_success "dcommitted code has proper description" \
  36. "git show | grep -q 'foo-quux'"
  37. test_expect_success "issue no longer has a branch" \
  38. "git cl status | grep -q 'work: None'"
  39. test_expect_success "upstream svn has our commit" \
  40. "svn log $REPO_URL 2>/dev/null | grep -q 'foo-quux'"
  41. )
  42. SUCCESS=$?
  43. cleanup
  44. if [ $SUCCESS == 0 ]; then
  45. echo PASS
  46. fi