]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - tools/make-git
Updated the make-scripts to git.
[people/ms/ipfire-3.x.git] / tools / make-git
1 #!/bin/bash
2 ###############################################################################
3 # #
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
6 # #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
11 # #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
16 # #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 # #
20 # A small helper to make the git functions comfortable #
21 # #
22 ###############################################################################
23 ###############################################################################
24 #
25 # Set the environment
26 #
27 ###############################################################################
28
29 [ -z $GIT_URL ] || exiterror "You have to setup GIT_USER first."
30
31 GIT_URL="ssh://${GIT_USER}@git.ipfire.org/pub/ipfire-3.x"
32
33 if [ -z $EDITOR ]; then
34 for i in nano emacs vi; do
35 EDITOR=$(which $i 2>/dev/null)
36 if ! [ -z $EDITOR ]; then
37 export EDITOR=$EDITOR
38 break
39 fi
40 done
41 [ -z $EDITOR ] && exiterror "You should have installed an editor."
42 fi
43
44 ###############################################################################
45 #
46 # A small helper to make the git functions comfortable
47 #
48 ###############################################################################
49
50 git_pull() {
51 git pull
52 }
53
54 git_push() {
55 git push ${GIT_URL} master
56 }
57
58 git_commit() {
59 git commit $*
60
61 [ "$?" -eq "0" ] || exiterror "git commit $* failed."
62
63 echo "${BOLD}Do you want to push, too? [y/N]${NORMAL}"
64 read
65 for i in y Y j J; do
66 if [ "$i" -eq "$REPLY" ]; then
67 git_push
68 exit $?
69 fi
70 done
71 }
72
73 git_diff(){
74 echo -ne "Make a local diff to last revision"
75 git diff > ipfire-diff-$(date +'%Y-%m-%d-%H:%M').diff
76 evaluate 1
77 echo "Diff was successfully saved to ipfire-diff-$(date +'%Y-%m-%d-%H:%M').diff"
78 git diff --stat
79 }
80
81 git_log() {
82 echo -n "Updateing changelog from repository..."
83
84 [ -z $GIT_TAG ] || LAST_TAG=$GIT_TAG
85 [ -z $LAST_TAG ] || EXT="$LAST_TAG..HEAD"
86
87 git log --pretty=short --no-color $EXT > $BASEDIR/doc/ChangeLog
88
89 beautify message DONE
90 }