make_version 950 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/sh
  2. if [ -f ${1}/.version ]; then
  3. cat ${1}.version
  4. elif [ -f ${1}/.svnrevision ]; then
  5. echo SVN-`cat ${1}/.svnbranch`-r`cat ${1}/.svnrevision`
  6. elif [ -d .svn ]; then
  7. PARTS=`LANG=C svn info ${1} | grep URL | awk '{print $2;}' | sed -e 's:^.*/svn/menuselect/::' | sed -e 's:/: :g'`
  8. BRANCH=0
  9. TEAM=0
  10. REV=`svnversion -c ${1} | cut -d: -f2`
  11. if [ "${PARTS}" = "trunk" ]
  12. then
  13. echo SVN-'trunk'-r${REV}
  14. exit 0
  15. fi
  16. for PART in $PARTS
  17. do
  18. if [ ${BRANCH} != 0 ]
  19. then
  20. RESULT="${RESULT}-${PART}"
  21. break
  22. fi
  23. if [ ${TEAM} != 0 ]
  24. then
  25. RESULT="${RESULT}-${PART}"
  26. continue
  27. fi
  28. if [ "${PART}" = "branches" ]
  29. then
  30. BRANCH=1
  31. RESULT="branch"
  32. continue
  33. fi
  34. if [ "${PART}" = "tags" ]
  35. then
  36. BRANCH=1
  37. RESULT="tag"
  38. continue
  39. fi
  40. if [ "${PART}" = "team" ]
  41. then
  42. TEAM=1
  43. continue
  44. fi
  45. done
  46. echo SVN-${RESULT##-}-r${REV}
  47. fi