forked from linux-rdma/opensm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_chlog.sh
executable file
·67 lines (53 loc) · 1.04 KB
/
gen_chlog.sh
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
#!/bin/sh
usage()
{
echo "Usage: $0 [--spec]"
exit 2
}
if [ "$1" = "--spec" ] ; then
spec_format=1
fi
GIT_DIR=`git rev-parse --git-dir 2>/dev/null`
test -z "$GIT_DIR" && usage
export GIT_DIR
export GIT_PAGER=""
export PAGER=""
mkchlog()
{
format=$1
prev_tag=""
for tag in `git tag -l '*' | sort -V` ; do
obj=`git describe $tag`
base=`git merge-base $obj HEAD`
if [ -z "$base" -o "$base" != $obj ] ; then
continue
fi
all_vers="$prev_tag$tag $all_vers"
prev_tag=$tag..
done
if [ -z "$prev_tag" ] ; then
all_vers=HEAD
else
all_vers="${prev_tag}HEAD $all_vers"
fi
for ver in $all_vers ; do
log_out=`git log $ver -- ./`
if [ -z "$log_out" ] ; then
continue
fi
ver_name=`echo $ver | sed -e 's/^.*\.\.//'`
echo ""
echo "** Version: $ver_name"
echo ""
git log --no-merges "${format}" $ver -- ./
prev_t=$tag..
done
}
if [ -z "$spec_format" ] ; then
mkchlog --pretty=format:"%ad %an%n%H%n%n* %s%n" \
| sed -e 's/^\* /\t* /'
else
echo "%changelog"
mkchlog --pretty=format:"- %ad %an: %s"
echo ""
fi