]> git.wh0rd.org Git - home.git/commitdiff
more bin scripts
authorMike Frysinger <vapier@gentoo.org>
Fri, 4 Sep 2009 05:46:24 +0000 (01:46 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sat, 28 Apr 2012 19:36:08 +0000 (15:36 -0400)
.bin/bash-colors [new file with mode: 0755]
.bin/git-format-request-pull
.bin/git-log [new file with mode: 0755]
.bin/git-patch-status [new file with mode: 0755]

diff --git a/.bin/bash-colors b/.bin/bash-colors
new file mode 100755 (executable)
index 0000000..bef5130
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+for i in {0..1} ; do
+       for j in {30..37} ; do
+               echo -e '\e['"${i};${j}mthis color is: \\\\e[${i};${j}m"
+       done
+done
index 9845b00789e81593273a284ffe55f5978da576eb..a122ebde65c2af41a28886a6b8fd587f448dd95a 100755 (executable)
@@ -6,6 +6,7 @@ usage() {
 }
 
 auto=false
+eval set -- `getopt -- eh "$@"`
 while [[ -n $1 ]] ; do
        case $1 in
                -h|--help) usage;;
@@ -17,9 +18,14 @@ while [[ -n $1 ]] ; do
        shift
 done
 
-commit=$1
+commit=${1:-mainline/master}
 url=$(git config --get remote.origin.url)
 branch=${2:-master}
+if [[ ${branch} != master ]] ; then
+       subject=" (${branch} branch)"
+else
+       subject=""
+fi
 
 if [[ -z ${commit} ]] || [[ -n $3 ]] ; then
        usage 1
@@ -28,12 +34,13 @@ fi
 name=$(git config --get user.name)
 email=$(git config --get user.email)
 tmp=$(mktemp)
+request=$(PAGER= git request-pull ${commit} ${url} ${branch}) || exit 1
 cat << EOF > ${tmp}
 From: ${name} <${email}>
 Date: $(date -R)
-Subject: Pull request ${url##*/}
+Subject: Pull request ${url##*/}${subject}
 
-$(git request-pull ${commit} ${url} ${branch})
+${request}
 EOF
 cat ${tmp}
 
diff --git a/.bin/git-log b/.bin/git-log
new file mode 100755 (executable)
index 0000000..90a1dbf
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec git log --pretty='format:%Cred%h%Creset %Cgreen%ai%Creset %s' "$@"
diff --git a/.bin/git-patch-status b/.bin/git-patch-status
new file mode 100755 (executable)
index 0000000..1289d37
--- /dev/null
@@ -0,0 +1,115 @@
+#!/bin/bash
+
+url="http://git.kernel.org/?p=linux/kernel/git/vapier/blackfin.git;a=commitdiff;h="
+rev=$1
+if [[ -z ${rev} ]] ; then
+       rev=$(git log --pretty='format:%H %s' | sed -n '/LOCAL/{s: .*::;p;q}')
+fi
+
+set -- `git rev-list ${rev}..HEAD`
+
+cat << EOF
+====== Blackfin Linux Kernel Tree Status ======
+
+Last updated at **`date`**
+
+Number of patches in Blackfin tree: **$#**
+EOF
+
+get_status() {
+       local info tid status subj="$*"
+
+       info=$(echo "${subj}" | grep -o '^\[local[^]]*]')
+       info=${info#[} # chop leading [
+       info=${info%]} # chop trailing ]
+       if [[ ${info} == *:* ]] ; then
+               tid=${info#*:} # extract tracker id
+               info=${info%:*} # chop tracker id
+       else
+               tid=
+       fi
+       info=${info#local/} # chop leading "local/"
+       case ${info} in
+               "")          status="ready for submission";;
+               LOCAL)       status="keep locally forever";;
+               local)       status="keep local";;
+               lkml)        status="fix LKML feedback";;
+               cleanup)     status="needs code/style cleanup";;
+               correct)     status="change does not seem to be correct";;
+               dead)        status="dead code to be punted";;
+               design)      status="waiting for response from hardware design";;
+               generalize)  status="needs generalizing/abstracting to avoid #if mess";;
+               no-sob)      status="missing Signed-off-by tag from author";;
+               split)       status="patch needs to be split";;
+               *)           status="keep local (unknown reason '${info}')";;
+       esac
+       [[ -n ${tid} ]] && status="${status}; pending [[bf>tracker/${tid}]]"
+
+       echo "${status}"
+}
+get_patch_info() {
+       if [[ $2 != -b ]] ; then
+               body=$(git log -n1 --stat=100,100 --pretty='format:%b' $r | \
+                       sed \
+                               -e '/: /s:<.*@.*>:<...>:' \
+                               -e '/^Acked-by: /d' \
+                               -e '/^Signed-off-by: /d' \
+                               -e '/^CC: /d')
+       else
+               body=
+       fi
+       subj=$(git log -n1 --pretty='format:%s' $r)
+       status=$(get_status "${subj}")
+       subj=$(echo "${subj}" | sed 's:^\[local[^]]*] ::')
+}
+
+cat << EOF
+
+===== By Status =====
+EOF
+
+cat << EOF
+
+==== Pending ====
+
+EOF
+for r in "$@" ; do
+       get_patch_info $r -b
+
+       case ${status} in
+               "ready for submission") ;;
+               *)              echo "  - [[#${subj}]]: ${status}";;
+       esac
+done
+
+cat << EOF
+
+==== Ready ====
+
+EOF
+for r in "$@" ; do
+       get_patch_info $r -b
+
+       case ${status} in
+               "ready for submission") echo "  - [[#${subj}]]";;
+       esac
+done
+
+cat << EOF
+
+===== All Patches =====
+
+EOF
+for r in "$@" ; do
+       get_patch_info $r
+
+cat << EOF
+=== ${subj} ===
+
+Status: **${status}**
+
+[[${url}${r}|Commit]]:
+<code>${body}</code>
+
+EOF
+done