blob: bd903ad56c101065590a7d60e2ac492882de21bf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#!/bin/zsh
PROJECT_PATH="${HOME}/dev/espik"
TMPFILE="/tmp/.eci-${RANDOM}"
if [ ! -e ${PROJECT_PATH} ]; then
echo "PROJECT_PATH defined (${PROJECT_PATH}) doesn't exist"
exit -1
fi
if [ -z "${EDITOR}" ]; then
echo "EDITOR is not set"
exit -1
elif [ ! -e $(which ${EDITOR}) ]; then
echo "EDITOR doesn't exist"
exit -1
fi
touch ${TMPFILE}
if [ ! -e ${TMPFILE} ]; then
echo "Cannot write to /tmp"
echo "Check perms ;)"
exit -1
fi
chmod 600 ${TMPFILE}
cd ${PROJECT_PATH}
echo "
--This line and thoses under will be ignored--
$(svn st)
$(svn diff)" >> ${TMPFILE}
SUM_ORI=$(cksum ${TMPFILE} | awk '{print $1}')
${EDITOR} ${TMPFILE}
SUM_NEW=$(cksum ${TMPFILE} | awk '{print $1}')
if [ "${SUM_ORI}" = "${SUM_NEW}" ]; then
echo "Enter something !"
rm -f ${TMPFILE}
exit -1
fi
DELCOMMENTFROM=$(grep -n -- '--This line and thoses under will be ignored--' ${TMPFILE} | head -n 1 | cut -d ':' -f 1)
head -n $(($DELCOMMENTFROM-1)) ${TMPFILE} > ${TMPFILE}.send
SVN_ST=$(svn st | grep -v '^?')
ADDED_FILES=$(echo ${SVN_ST} | grep '^A' | awk '{print "+"$2}')
ADDED_FILES=${ADDED_FILES:+\\t${ADDED_FILES}\\n}
MODIFIED_FILES=$(echo ${SVN_ST} | grep '^M' | awk '{print " "$2}')
MODIFIED_FILES=${MODIFIED_FILES:+\\t${MODIFIED_FILES}\\n}
DELETED_FILES=$(echo ${SVN_ST} | grep '^D' | awk '{print "-"$2}')
DELETED_FILES=${DELETED_FILES:+\\t${DELETED_FILES}\\n}
echo -e "$(date "+%d/%m/%y %X") - from $(whoami)@$(if [ `uname -o` = "Cygwin" ]; then hostname; else hostname -f; fi)
${ADDED_FILES} ${MODIFIED_FILES} ${DELETED_FILES}
$(cat ${TMPFILE}.send | sed -r 's/(.*)/\t* \1/g')
$(cat ${PROJECT_PATH}/ChangeLog)" > ${PROJECT_PATH}/ChangeLog
svn ci -m "$(cat ${TMPFILE}.send)"
rm -f ${TMPFILE} ${TMPFILE}.send
|