]> git.wh0rd.org Git - home.git/blob - .bin/git-patch-status
cros-repo: rewrite in python
[home.git] / .bin / git-patch-status
1 #!/bin/bash
2
3 url="http://git.kernel.org/?p=linux/kernel/git/vapier/blackfin.git;a=commitdiff;h="
4 rev=$1
5 if [[ -z ${rev} ]] ; then
6         rev=$(git log --pretty='format:%H %s' | sed -n '/LOCAL/{s: .*::;p;q}')
7 fi
8
9 set -- `git rev-list ${rev}..HEAD`
10
11 cat << EOF
12 ====== Blackfin Linux Kernel Tree Status ======
13
14 Last updated at **`date`**
15
16 Number of patches in Blackfin tree: **$#**
17 EOF
18
19 get_status() {
20         local info tid status subj="$*"
21
22         info=$(echo "${subj}" | grep -o '^\[local[^]]*]')
23         info=${info#[} # chop leading [
24         info=${info%]} # chop trailing ]
25         if [[ ${info} == *:* ]] ; then
26                 tid=${info#*:} # extract tracker id
27                 info=${info%:*} # chop tracker id
28         else
29                 tid=
30         fi
31         info=${info#local/} # chop leading "local/"
32         case ${info} in
33                 "")          status="ready for submission";;
34                 LOCAL)       status="keep locally forever";;
35                 local)       status="keep local";;
36                 lkml)        status="fix LKML feedback";;
37                 cleanup)     status="needs code/style cleanup";;
38                 correct)     status="change does not seem to be correct";;
39                 dead)        status="dead code to be punted";;
40                 design)      status="waiting for response from hardware design";;
41                 generalize)  status="needs generalizing/abstracting to avoid #if mess";;
42                 log)         status="needs better change log";;
43                 no-sob)      status="missing Signed-off-by tag from author";;
44                 split)       status="patch needs to be split";;
45                 *)           status="keep local (unknown reason '${info}')";;
46         esac
47         [[ -n ${tid} ]] && status="${status}; pending [[bf>tracker/${tid}]]"
48
49         echo "${status}"
50 }
51 get_patch_info() {
52         if [[ $2 != -b ]] ; then
53                 body=$(git log -n1 --stat=100,100 --pretty='format:%b' $r | \
54                         sed \
55                                 -e '/: /s:<.*@.*>:<...>:' \
56                                 -e '/^Acked-by: /d' \
57                                 -e '/^Signed-off-by: /d' \
58                                 -e '/^CC: /d')
59         else
60                 body=
61         fi
62         subj=$(git log -n1 --pretty='format:%s' $r)
63         status=$(get_status "${subj}")
64         subj=$(echo "${subj}" | sed 's:^\[local[^]]*] ::')
65 }
66
67 cat << EOF
68
69 ===== By Status =====
70 EOF
71
72 cat << EOF
73
74 ==== Pending ====
75
76 EOF
77 for r in "$@" ; do
78         get_patch_info $r -b
79
80         case ${status} in
81                 "ready for submission") ;;
82                 *)              echo "  - [[#${subj}]]: ${status}";;
83         esac
84 done
85
86 cat << EOF
87
88 ==== Ready ====
89
90 EOF
91 for r in "$@" ; do
92         get_patch_info $r -b
93
94         case ${status} in
95                 "ready for submission") echo "  - [[#${subj}]]";;
96         esac
97 done
98
99 cat << EOF
100
101 ===== All Patches =====
102
103 EOF
104 for r in "$@" ; do
105         get_patch_info $r
106
107 cat << EOF
108 === ${subj} ===
109
110 Status: **${status}**
111
112 [[${url}${r}|Commit]]:
113 <code>${body}</code>
114
115 EOF
116 done