-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcheckin2
executable file
·74 lines (58 loc) · 1.32 KB
/
checkin2
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
70
71
72
73
74
#! /bin/sh
mode=cvs
required_commits="ChangeLog version.c"
lasttag=`cvs log -h version.c |
sed '1,/symbolic names:/d' |
head -1 |
awk '{print $1}' |
sed 's/://'`
version_line=`grep -i version version.c | head -1`
if [ "$version_line" = "" ]
then
version_line=`head -1 version.c`
fi
ver=`expr "$version_line" : '[^0-9]*\([0-9._]*\)' | sed 's/.*\.//'`
newtag=V$ver
if [ "$lasttag" = "$newtag" ]
then
echo "error: need to update version.c"
echo "last tag $lasttag"
exit 1
fi
head -3 ChangeLog | tail -1 | grep $newtag > /dev/null 2>&1
if [ $? != 0 ]
then
echo "error: ChangeLog out of date: $newtag"
exit 1
fi
msg=`cat ChangeLog |
sed -n -e "1{h;n}; /^[0-9]/{x;p}; /\<$lasttag\>/Q; /^[0-9]/!H"`
if [ $# -ne 0 ] ; then
# correct me if I'm wrong - it does not hurt to have same argument
# twice in cvs commit...
set -- "$@" $required_commits
fi
# diffstat output generation
diffstat=`which diffstat 2>&1`
echo "prev tag $lasttag; new tag $newtag"
if [ -x "$diffstat" ]
then
echo "=== diffstat output ==="
cvs diff -r $lasttag "$@" | $diffstat -w 70
fi
echo "====== LOG MESSAGE ====="
echo "$msg$sep$msgstat"
echo "========================"
echo -n "Ok? "
read x
if [ "$x" != "y" ]
then
exit 1
fi
cvs -z9 commit -R -m "$msg" "$@"
if [ $? != 0 ]
then
echo "error during cvs commit"
exit 1
fi
cvs -z9 tag -R $newtag