merge.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/sh
  2. #===-- merge.sh - Test the LLVM release candidates -------------------------===#
  3. #
  4. # The LLVM Compiler Infrastructure
  5. #
  6. # This file is distributed under the University of Illinois Open Source
  7. # License.
  8. #
  9. #===------------------------------------------------------------------------===#
  10. #
  11. # Merge a revision into a project.
  12. #
  13. #===------------------------------------------------------------------------===#
  14. set -e
  15. rev=""
  16. proj=""
  17. function usage() {
  18. echo "usage: `basename $0` [OPTIONS]"
  19. echo " -proj PROJECT The project to merge the result into"
  20. echo " -rev NUM The revision to merge into the project"
  21. }
  22. while [ $# -gt 0 ]; do
  23. case $1 in
  24. -rev | --rev | -r )
  25. shift
  26. rev=$1
  27. ;;
  28. -proj | --proj | -project | --project | -p )
  29. shift
  30. proj=$1
  31. ;;
  32. -h | -help | --help )
  33. usage
  34. ;;
  35. * )
  36. echo "unknown option: $1"
  37. echo ""
  38. usage
  39. exit 1
  40. ;;
  41. esac
  42. shift
  43. done
  44. if [ "x$rev" = "x" -o "x$proj" = "x" ]; then
  45. echo "error: need to specify project and revision"
  46. echo
  47. usage
  48. exit 1
  49. fi
  50. if ! svn ls http://llvm.org/svn/llvm-project/$proj/trunk > /dev/null 2>&1 ; then
  51. echo "error: invalid project: $proj"
  52. exit 1
  53. fi
  54. tempfile=`mktemp /tmp/merge.XXXXXX` || exit 1
  55. echo "Merging r$rev:" > $tempfile
  56. svn log -c $rev http://llvm.org/svn/llvm-project/$proj/trunk >> $tempfile 2>&1
  57. cd $proj.src
  58. echo "# Updating tree"
  59. svn up
  60. echo "# Merging r$rev into $proj locally"
  61. svn merge -c $rev https://llvm.org/svn/llvm-project/$proj/trunk . || exit 1
  62. echo
  63. echo "# To commit the merge, run the following in $proj.src/:"
  64. echo svn commit -F $tempfile
  65. exit 0