Add latest entry to ChangeLog
[gc-utils.git] / gc-commit.sh
blobc96be54e4e78e30afa9dec7de75570b1cb33ac67
1 #!/bin/sh
2 # Licensed under the terms of the MIT License
3 # See /usr/share/doc/gcutils/copyright
4 # or http://www.opensource.org/licenses/mit-license.php
5 VERSION="$VERSION$"
6 PROGNAME="$PROGNAME$"
8 check_git ()
11 git --version > /dev/null
13 if test $? != 0
14 then
15 echo >&2 "Git not found. It's either not installed or not in \$PATH"
16 exit 127
19 version=`git --version | grep -o "[12]\.[5-9]\.[0-9]"`
20 if test -z "$version"
21 then
22 echo "Wrong git version. $prog needs git 1.5.0 or higher, but "`git --version`" found."
23 exit 127
27 version ()
29 echo "$PROGNAME: "`basename $0`-$VERSION
32 usage ()
34 echo "Usage:" `basename $0`" [OPTIONS] <sha1>"
35 echo "Options are:"
36 echo " -h show help"
37 echo " -C run a cvsclean. "
38 echo " WARNING: this will run cvs up -C"
39 echo " and then remove all found .#* files"
40 echo " -c commit to cvs if no errors occured"
41 echo " -f force patching in case of an unclean"
42 echo " cvs repository"
43 echo " -V show version information"
44 echo
45 exit 127
48 check_git
50 cvsclean=
51 commit=
52 force=
53 while test $# != 0
54 do
55 case "$1" in
56 -c)
57 commit="-c"
59 -C)
60 cvsclean=t
62 -f)
63 force="-f"
65 -h)
66 usage
68 -V)
69 version
70 exit 127
72 -*)
73 echo >&2 "Parameter $1 is not known."
74 usage
77 break
79 esac
80 shift
81 done
83 if test $# = 0 ; then
84 usage
88 if test cvsclean = "t"
89 then
90 cd ".cvs" && cvs up -C && find . -iname ".#*" -exec rm '{}' \;
91 cd $OLDDIR
94 if test -d ".git" -a -d ".cvs"
95 then
96 git-cvsexportcommit -v $force $commit -u -w ".cvs/" $1
97 else
98 if test -d ".git"
99 then
100 echo >&2 "Not a git repository"
103 if test -d ".cvs"
104 then
105 echo >&2 "No cvs repository found in .cvs. "
106 echo >&2 "Make sure you follow the standards"