forked from alikins/gitconfig
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-showbugs
More file actions
executable file
·77 lines (67 loc) · 1.57 KB
/
git-showbugs
File metadata and controls
executable file
·77 lines (67 loc) · 1.57 KB
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
75
76
77
#!/bin/bash
usage() {
print "show-bugs [-w|--web] [-e|--errata] [-s|--status] bug_status log_options "
}
status=
log_opts=
while [ "$1" != "" ]; do
case $1 in
-s | --status )
shift
status=$1
;;
-w | --web )
web=1
;;
-h | --help )
usage
exit
;;
-e | --errata )
errata=1
;;
* )
log_opts="${log_opts} ${1}"
shift;
;;
esac
shift
done
# echo "git log --format="format:%s" --grep "^[[:digit:]]\\+:" $log_opts | awk -F":" '{print $1 }'"
buglist() {
# support bug slug formats
# 12345: sdfasd
# 123456 - sdfasdf
# Bug 3423423 - sdfasd
# 123124-ssdfsdf
# these log regexes are mostly just to weed out some volume,
# we still basically search for 5+ digit numbers
for bug in $(git log --format="format:%s" \
--grep="^[[:digit:]]-.*" \
--grep="Bug [[:digit:]]\\+\s-\s" \
--grep="^[[:digit:]]\\+\s-\s" \
--grep="[[:digit:]]\\+" \
$log_opts \
| grep -E -o "[[:digit:]]{5,}")
do
echo -n $bug,
done
};
buglist_raw() {
(IFS=,;set -- $(echo "$1") ;echo $*)
}
open_browser()
{
xdg-open "https://bugzilla.redhat.com/buglist.cgi?bug_id=$1;bug_status=$2" ;
};
bugs=$(buglist)
if [ -z "$bugs" ] ; then
exit
fi
if [ "$web" == "1" ] ; then
open_browser "$bugs" "$status" > /dev/null 2>&1
elif [ "$errata" == "1" ] ; then
echo $(buglist_raw "$bugs")
else
bugzilla query --bug_status "$status" -b $(buglist)
fi