aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/commit
blob: d74747e95692ec2201f68e20152abce2b3df679a (plain)
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
#!/bin/bash
# need a Posix shell, so we simply use bash

set -e

uid=`id -u`
date=`date`
name=$(awk -F: "\$3==$uid { print \$5 }" /etc/passwd )
addr="<`id -un`@`hostname -d`>"

for i in `find . -name Changes -print`; do
    dir=`dirname $i`
    if [ -s $dir/Changes ]; then
	lines=`wc -l <$dir/Changes`
	echo "$date  $name  $addr" >$dir/ChangeLog.new
	echo >>$dir/ChangeLog.new
	cat $dir/Changes   >>$dir/ChangeLog.new
	[ -f $dir/ChangeLog ] && cat $dir/ChangeLog >>$dir/ChangeLog.new
	echo -n > $dir/Changes
	[ -f $dir/ChangeLog ] && rm $dir/ChangeLog
	mv $dir/ChangeLog.new $dir/ChangeLog
	echo "$lines new lines in $dir/ChangeLog"
    fi
done

cvs commit -m "See ChangeLog: $date  $name" $*