You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

merge.sh 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. FROM=$1
  3. REVISION=$2
  4. AUTOCOMMIT=$3
  5. if [ "$FROM" = "" ] || [ "$REVISION" = "" ]
  6. then
  7. echo "Usage: $0 <from version> <changeset> [autocommit]"
  8. exit 2
  9. fi
  10. localchanges=`svn stat|wc -l`
  11. if [ "$localchanges" != "0" ]
  12. then
  13. echo "You must have a clean working space copy"
  14. exit 2
  15. fi
  16. if [ "$SVN_PASS_FILE" != "" ]
  17. then
  18. SVN_PASS=`cat "$SVN_PASS_FILE"`
  19. fi
  20. svn up
  21. currentrepowithoutversion=`svn info|grep URL|sed "s/URL: //"|sed "s/\/[^\/]*$//"`
  22. sourceurl="$currentrepowithoutversion/$FROM"
  23. msg=`svn log $sourceurl -r $REVISION --xml|grep "<msg>"|sed "s/<msg>//"|sed "s/<\/msg>//"`
  24. svn merge $sourceurl . -c $REVISION
  25. if [ "$?" != "0" ]
  26. then
  27. echo "Merge failed. Conflicts must be resolved manually!"
  28. exit 3
  29. fi
  30. msg="[merge from $FROM] $msg"
  31. if [ "$AUTOCOMMIT" = "autocommit" ]
  32. then
  33. echo "Trying to commit..."
  34. if [ "$SVN_USER" != "" ]
  35. then
  36. svn commit -m "$msg" --username $SVN_USER --password $SVN_PASS
  37. else
  38. svn commit -m "$msg"
  39. fi
  40. RET=$?
  41. if [ "$RET" != "0" ]
  42. then
  43. exit 1
  44. fi
  45. exit 0
  46. else
  47. echo "Run the following command to commit..."
  48. echo svn commit -m \"$msg\"
  49. exit 1
  50. fi