Readme added
[gc-utils.git] / gc-commit.sh
blobc2adf472215b1747ac80cf464148457e805828f7
1 #!/bin/sh
2 VERSION="$VERSION$"
3 PROGNAME="$PROGNAME$"
5 version ()
6 {
7 echo "$PROGNAME: "`basename $0`-$VERSION
10 usage ()
12 echo "Usage:" `basename $0`" [OPTIONS] <sha1>"
13 echo "Options are:"
14 echo " -h show help"
15 echo " -C run a cvsclean. "
16 echo " WARNING: this will run cvs up -C"
17 echo " and then remove all found .#* files"
18 echo " -c commit to cvs if no errors occured"
19 echo " -f force patching in case of an unclean"
20 echo " cvs repository"
21 echo " -V show version information"
22 echo
23 exit 127
26 cvsclean=
27 commit=
28 force=
29 while test $# != 0
30 do
31 case "$1" in
32 -c)
33 commit="-c"
35 -C)
36 cvsclean=t
38 -f)
39 force="-f"
41 -h)
42 usage
44 -V)
45 version
46 exit 127
48 -*)
49 echo >&2 "Parameter $1 is not known."
50 usage
53 break
55 esac
56 shift
57 done
59 if test $# = 0 ; then
60 usage
64 if test cvsclean = "t"
65 then
66 cd ".cvs" && cvs up -C && find . -iname ".#*" -exec rm '{}' \;
67 cd $OLDDIR
70 if test -d ".git" -a -d ".cvs"
71 then
72 git-cvsexportcommit -v $force $commit -u -w ".cvs/" $1
73 else
74 if test -d ".git"
75 then
76 echo >&2 "Not a git repository"
79 if test -d ".cvs"
80 then
81 echo >&2 "No cvs repository found in .cvs. "
82 echo >&2 "Make sure you follow the standards"