forked from CristianHenzel/ClipIt
-
Notifications
You must be signed in to change notification settings - Fork 1
/
commit
executable file
·61 lines (51 loc) · 1.92 KB
/
commit
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
#!/bin/bash
## Copyright (C) 2010-2012 by Cristian Henzel <oss@rspwn.com>
##
## This file is part of ClipIt.
##
## ClipIt is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## ClipIt is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
git clean -xdf
./update-po
git clean -xdf
COMMIT_FILE="COMMIT_MSG"
CLIPIT_LAST_VSTR=$(git log -1 --pretty="format:%s" | cut -d'-' -f3 | sed s/^........//)
CLIPIT_LAST_DSTR=$(git log -1 --pretty="format:%s" | cut -d'-' -f3 | sed s/...$//)
CLIPIT_NEXT_DSTR=$(date +"%Y%m%d")
CLIPIT_NEXT_DCOM=$(date +"%Y-%m-%d %X %z")
CLIPIT_NEXT_VSTR=$(cat configure.in | grep AC_INIT | awk '{print $2}' | sed s/[][,]//g)
if [ "$CLIPIT_LAST_DSTR" = "$CLIPIT_NEXT_DSTR" ]; then
CLIPIT_NEXT_ASTR="00"$(expr $CLIPIT_LAST_VSTR + 1)
else
CLIPIT_NEXT_ASTR="001"
fi
CLIPIT_NEXT_CSTR="ClipIt-${CLIPIT_NEXT_VSTR}-${CLIPIT_NEXT_DSTR}${CLIPIT_NEXT_ASTR}"
echo "$CLIPIT_NEXT_CSTR ~ ${CLIPIT_NEXT_DCOM}" > "$COMMIT_FILE"
echo "" >> "$COMMIT_FILE"
echo "+ " >> "$COMMIT_FILE"
echo "" >> "$COMMIT_FILE"
gedit "$COMMIT_FILE"
cat "$COMMIT_FILE" | sed /^#/d > ChangeLog
echo "" >> ChangeLog
git log --no-merges --pretty="format:%s - %ai%n%n%b%n" >> ChangeLog
sed -i "s/ ~ .*//" "$COMMIT_FILE"
echo "Will now commit with:"
cat "$COMMIT_FILE"
git commit -a -F "$COMMIT_FILE"
read -p "Pushing changes. Continue (yes/no)? "
if [ "$REPLY" != "yes" -a ! -z "$REPLY" ]; then
exit 1;
fi
git push --all
git push --all github
rm "$COMMIT_FILE"