From: Mike Frysinger Date: Fri, 4 Sep 2009 05:46:24 +0000 (-0400) Subject: more bin scripts X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=8069c098fceb3042ac94f947ae344b0ae7761b97;p=home.git more bin scripts --- diff --git a/.bin/bash-colors b/.bin/bash-colors new file mode 100755 index 0000000..bef5130 --- /dev/null +++ b/.bin/bash-colors @@ -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 diff --git a/.bin/git-format-request-pull b/.bin/git-format-request-pull index 9845b00..a122ebd 100755 --- a/.bin/git-format-request-pull +++ b/.bin/git-format-request-pull @@ -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 index 0000000..90a1dbf --- /dev/null +++ b/.bin/git-log @@ -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 index 0000000..1289d37 --- /dev/null +++ b/.bin/git-patch-status @@ -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]]: +${body} + +EOF +done