[85] | 1 | #!/bin/bash |
---|
| 2 | |
---|
[82] | 3 | #----------------------------------------------------------- |
---|
| 4 | # $Id$ |
---|
| 5 | #----------------------------------------------------------- |
---|
| 6 | #-----[ usage ]--------------------------------------------- |
---|
| 7 | function usage () |
---|
| 8 | { |
---|
[145] | 9 | echo "Usage : ${0} action"; |
---|
| 10 | echo "Arguments : "; |
---|
[138] | 11 | echo " * action"; |
---|
[145] | 12 | echo " * add : add all file unpresent in project and set proprity"; |
---|
| 13 | echo " * commit : update revision number and commit"; |
---|
| 14 | echo " * status : print only locally modified items"; |
---|
| 15 | echo " * status_new : print only locally new items"; |
---|
| 16 | echo " * status_delete : print only locally new items"; |
---|
| 17 | echo " * local_status_new : print only locally new items"; |
---|
| 18 | echo " * local_status_delete : print only locally new items"; |
---|
| 19 | echo " * help : print this message"; |
---|
| 20 | echo "Note :"; |
---|
[82] | 21 | echo " * Morpheo's environnement must be positionned."; |
---|
| 22 | exit; |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | #-----[ main ]---------------------------------------------- |
---|
| 26 | function main () |
---|
| 27 | { |
---|
| 28 | # Test operand |
---|
| 29 | if test ${#} -ne 1; then |
---|
| 30 | usage ${*}; |
---|
| 31 | fi; |
---|
| 32 | |
---|
| 33 | if test -z ${MORPHEO_TOPLEVEL}; then |
---|
| 34 | usage ${*}; |
---|
| 35 | fi; |
---|
| 36 | |
---|
[138] | 37 | local file_version="${MORPHEO_TOPLEVEL}/Version"; |
---|
| 38 | local major_version="0"; |
---|
| 39 | local minor_version="2"; |
---|
| 40 | local codename="Castor"; |
---|
| 41 | |
---|
[82] | 42 | export LC_ALL=C; |
---|
| 43 | export EDITOR="emacs"; |
---|
| 44 | |
---|
[138] | 45 | local pwd=${PWD}; |
---|
[82] | 46 | |
---|
| 47 | case ${1} in |
---|
| 48 | "commit") |
---|
| 49 | cd ${MORPHEO_TOPLEVEL}; |
---|
| 50 | |
---|
| 51 | # +1 because is the next revision |
---|
[138] | 52 | local revision=$(($(export LC_ALL=C; svnversion | tr -d [:alpha:] | cut -d : -f 2) + 1)); |
---|
| 53 | local date_day=$(date +%d); |
---|
| 54 | local date_month=$(date +%m); |
---|
| 55 | local date_year=$(date +%Y); |
---|
[88] | 56 | |
---|
[137] | 57 | echo "${major_version} ${minor_version} ${revision} ${codename} ${date_day} ${date_month} ${date_year}" > ${file_version}; |
---|
| 58 | |
---|
[82] | 59 | svn commit; |
---|
| 60 | |
---|
| 61 | cd ${pwd}; |
---|
| 62 | ;; |
---|
| 63 | |
---|
| 64 | "add") |
---|
| 65 | cd ${MORPHEO_TOPLEVEL}; |
---|
| 66 | |
---|
| 67 | for i in $(svn status | grep '?'); do |
---|
| 68 | if test -e ${i}; then |
---|
| 69 | svn add ${i}; |
---|
| 70 | svn propset svn:keywords "Id" ${i} -R |
---|
| 71 | fi; |
---|
| 72 | done; |
---|
| 73 | |
---|
| 74 | cd ${pwd}; |
---|
| 75 | ;; |
---|
[83] | 76 | |
---|
| 77 | "status") |
---|
| 78 | cd ${MORPHEO_TOPLEVEL}; |
---|
| 79 | |
---|
| 80 | svn status; |
---|
| 81 | |
---|
| 82 | cd ${pwd}; |
---|
| 83 | ;; |
---|
| 84 | |
---|
| 85 | "status_new") |
---|
| 86 | cd ${MORPHEO_TOPLEVEL}; |
---|
| 87 | |
---|
| 88 | svn status | grep '?'; |
---|
| 89 | |
---|
| 90 | cd ${pwd}; |
---|
| 91 | ;; |
---|
[138] | 92 | |
---|
| 93 | "status_delete") |
---|
| 94 | cd ${MORPHEO_TOPLEVEL}; |
---|
| 95 | |
---|
| 96 | svn status | grep '!'; |
---|
| 97 | |
---|
| 98 | cd ${pwd}; |
---|
| 99 | ;; |
---|
[145] | 100 | |
---|
| 101 | "local_status_new") |
---|
| 102 | #cd ${MORPHEO_TOPLEVEL}; |
---|
| 103 | |
---|
| 104 | svn status | grep '?'; |
---|
| 105 | |
---|
| 106 | #cd ${pwd}; |
---|
| 107 | ;; |
---|
| 108 | |
---|
| 109 | "local_status_delete") |
---|
| 110 | #cd ${MORPHEO_TOPLEVEL}; |
---|
| 111 | |
---|
| 112 | svn status | grep '!'; |
---|
| 113 | |
---|
| 114 | #cd ${pwd}; |
---|
| 115 | ;; |
---|
[83] | 116 | |
---|
[82] | 117 | "help") |
---|
| 118 | usage ${*}; |
---|
| 119 | ;; |
---|
| 120 | *) |
---|
| 121 | usage ${*}; |
---|
| 122 | esac |
---|
| 123 | } |
---|
| 124 | |
---|
| 125 | #-----[ Body ]---------------------------------------------- |
---|
| 126 | main ${*} |
---|