From fd7515cd2206dc00b7e99a8322f6d4ae8e58f212 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Fri, 30 Nov 2012 10:42:38 +1100 Subject: [PATCH] updates --- do_stats | 46 +++++++++++++++++++++++++++++++++++ import_quilt_series | 58 --------------------------------------------- remove_oldest | 20 ++++++++++++++++ 3 files changed, 66 insertions(+), 58 deletions(-) create mode 100755 do_stats delete mode 100755 import_quilt_series create mode 100755 remove_oldest diff --git a/do_stats b/do_stats new file mode 100755 index 0000000..36012ce --- /dev/null +++ b/do_stats @@ -0,0 +1,46 @@ +#!/bin/bash + +base=$1 +next=$2 +rc=$3 + +sd=../stats + +[ -d $sd ] || mkdir $sd || { + echo "No stats dir" 1>&2 + exit 1 +} + +git rev-list --no-merges $base..$next | sort >$sd/$next.sha1s +git rev-list --no-merges $base..$rc | sort >$sd/$rc.sha1s + +# filter out the common commits +comm -12 $sd/$next.sha1s $sd/$rc.sha1s >$sd/common_sha1s +comm -23 $sd/$next.sha1s $sd/$rc.sha1s >$sd/$next.sha1s.1 +comm -13 $sd/$next.sha1s $sd/$rc.sha1s >$sd/$rc.sha1s.1 + +# now find commits with the same patch-id +git diff-tree -p --stdin <$sd/$next.sha1s.1 | + git patch-id | + sort >$sd/$next.patch_ids +git diff-tree -p --stdin <$sd/$rc.sha1s.1 | + git patch-id | + sort >$sd/$rc.patch_ids +join -j 1 $sd/$next.patch_ids $sd/$rc.patch_ids >$sd/common_id +join -v 1 -j 1 $sd/$next.patch_ids $sd/$rc.patch_ids | + sed 's/^.* //' >$sd/$next.sha1s.2 +join -v 2 -j 1 $sd/$next.patch_ids $sd/$rc.patch_ids | + sed 's/^.* //' >$sd/$rc.sha1s.2 + +# now find commits with the same subject line +git log --stdin --no-walk --format='%s|%H' <$sd/$next.sha1s.2 | + sed 's/|\(.*\)|/_\1|/g' | + sort -f -k 1,1 -t '|' >$sd/$next.subj +git log --stdin --no-walk --format='%s|%H' <$sd/$rc.sha1s.2 | + sed 's/|\(.*\)|/_\1|/g' | + sort -f -k 1,1 -t '|' >$sd/$rc.subj +join -i -j 1 -t '|' $sd/$next.subj $sd/$rc.subj >$sd/common_subj +join -v 1 -i -j 1 -t '|' $sd/$next.subj $sd/$rc.subj | + sed 's/^.*|//' >$sd/$next.sha1s.3 +join -v 2 -i -j 1 -t '|' $sd/$next.subj $sd/$rc.subj | + sed 's/^.*|//' >$sd/$rc.sha1s.3 diff --git a/import_quilt_series b/import_quilt_series deleted file mode 100755 index baf4310..0000000 --- a/import_quilt_series +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -quilt_dir="../quilt" - -name="$1" - -sfile="$quilt_dir/$name/series" -base=$(sed -n 's/^[# ]*NEXT_BASE[ ]*\(.*\)[ ]*$/\1/p' "$sfile") -if [ -n "$base" ]; then - base=$(grep -v '^#' ../real_control | awk -F ' ' '$3=="'"$base"'" { if ($2=="quilt") printf("quilt/%s", "'"$base"'"); else printf("%s/%s", "'"$base"'", $5); }') -else - base=$(sed -n 's/^[# ]*BASE[ ]*\(.*\)[ ]*$/\1/p' "$sfile") -fi -rbase="$base" -case "$base" in -*-git[0-9]*) rbase=$(wget -q -O - "http://www.kernel.org/pub/linux/kernel/v2.6/snapshots/patch-${base}.id") - ;; -commit*) rbase=$(expr "$base" : "commit[ ]*\(.*\)") - ;; -[0-9]*.*) rbase="v$base" - ;; -esac -#log "Importing $name based on $base" -git rev-list -n 1 "$rbase" -- >/dev/null 2>&1 || { -# log "Unknown BASE" - continue -} -grep -q NEXT_PATCHES "$sfile" && { - mv -f "$sfile" "$sfile.orig" - do_echo=: - while read line; do - case $line in - *NEXT_PATCHES_START*) do_echo=echo - ;; - *NEXT_PATCHES_END*) do_echo=: - ;; - esac - $do_echo $line - done <"$sfile.orig" >"$sfile" -} - -#execute git branch -D "next-quilt-$name" -git branch -D "next-quilt-$name" -#execute git checkout -b "next-quilt-$name" "$rbase" || sh -i || { -git checkout -b "next-quilt-$name" "$rbase" || sh -i || { - [ -f "$sfile.orig" ] && mv -f $sfile.orig $sfile - exit 1 -} -author=$(grep -v '^#' ../real_control | awk -F ' ' '$3=="'"$name"'" { printf("%s", $1); }' | sed 's/,.*$//') -#execute git quiltimport --author "$author" --patches "$quilt_dir/$name" || sh -i || { -git quiltimport --author "$author" --patches "$quilt_dir/$name" || sh -i || { - [ -f "$sfile.orig" ] && mv -f $sfile.orig $sfile - exit 1 -} - -[ -f "$sfile.orig" ] && - mv -f $sfile.orig $sfile - diff --git a/remove_oldest b/remove_oldest new file mode 100755 index 0000000..7443bef --- /dev/null +++ b/remove_oldest @@ -0,0 +1,20 @@ +#!/bin/bash + +oldest=$(git tag -l next-\* | head -n 1) +[ "$oldest" ] || { + echo "Could not find oldest next- tag" 1>&2 + exit 1 +} +od=${oldest#next-} +[ "$od" = "$oldest" ] && { + echo "Hmmm, oldest next- tag '$oldest' does not start with next-" 1>&2 + exit 1 +} + +git tag -d $oldest +git push korg --delete $oldest +for r in $(git for-each-ref --format='%(refname)' "refs/next/$od"); do + git update-ref -d $r +done + +exit 0 -- 2.39.5