forked from alikins/gitconfig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-bugbyrelease
executable file
·60 lines (51 loc) · 1.41 KB
/
git-bugbyrelease
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
#!/bin/bash
# walk over a tito managed git repo, looking for bug id's in commits
# and displays them grouped by release
declare -a releases
while [ "$1" != "" ]; do
case $1 in
-h | --help ) usage
exit
;;
-f | --features ) showfeatures=1
;;
*)
log_opts="$*"
shift;
;;
esac
shift
done
branch=
releases=( $(git log $log_opts --grep="Automatic" --format="format:%H") )
buglist () {
bugs=$(git showbugs $1 $2)
if [ -n "$bugs" ] ; then
echo "$bugs"
echo
fi
if [ "$showfeatures" == "1" ] ; then
features=$(git showfeatures $1 $2)
if [ -n "$features" ] ; then
echo "$features"
echo
fi
fi
}
#handle the special case of changes that aren't released yet
head=$(git log -n1 --format="format:%H")
echo "HEAD"
if [ "$head" != "${releases[0]}" ] ; then
buglist $head...${releases[0]}
fi
count=${#releases[@]}
for (( i = 0 ; i < count; i++ ))
do
#echo ${releases[$i]}...${releases[$i+1]}
if [ -n "${releases[$i]}" ] && [ -n "${releases[$i+1]}" ] ; then
git describe --exact-match "${releases[$i]}"
# if we want to show the previous release
#git describe --exact-match "${releases[$i+1]}"
buglist ${releases[$i]}...${releases[$i+1]}
fi
done