#!/bin/bash --norc
-LOG_FILE="../summary"
+d="$1"
+prev="$2"
+
+LOG_FILE="../stats/next-$d-summary"
cp /dev/null $LOG_FILE
echo "$@" | tee -a $LOG_FILE
}
+plog()
+{
+ printf "$@" | tee -a $LOG_FILE
+}
+
patch_and_sha_ids()
{
echo "$*" | xargs -r -n 1 git diff-tree -p | git patch-id | sort
patch_and_sha_ids "$@" | cut -d' ' -f1
}
-heads=$(grep -v '^#' ../real_control | awk -F ' ' '$2=="quilt" { printf("quilt/%s ", $3); } $2=="git" { printf("%s/%s ", $3, $5); }')
+trees=$(grep -v '^#' ../real_control | awk -F ' ' '{ printf("%s ", $3); }')
seen_ids=""
seen_heads=""
seen_sha1s=""
-for h in $heads; do
+plog '%-20s %7s' "Tree" "commits"
+[ "$prev" ] &&
+ plog ' %s' "since next-$prev"
+plog '\n\n'
+
+for t in $trees; do
+
+ [ "$t" = "origin" ] &&
+ continue
+
+ [ "$prev" ] && {
+ prev_num=$(egrep "^$t +[0-9]+" "../stats/next-$prev-summary")
+ if [ "$prev_num" ]; then
+ prev_num=$(expr "$prev_num" : "[^ ]* *\([0-9]*\).*")
+ else
+ prev_num=0
+ fi
+ }
+
+ h="next-$d/$t"
+ git rev-parse --verify "$h" >/dev/null 2>&1 ||
+ continue
+
mb=$(git merge-base origin/master $h)
rh=$(git rev-parse $h)
[ "$mb" = "$rh" ] && {
- log $h
+ plog '%-20s %7d' $t 0
+ [ "$prev" ] &&
+ plog ' %+7d' $((0 - prev_num))
+ plog '\n'
continue
}
c=$(git rev-list --no-merges $mb...$rh $seen_heads | sort)
seen_heads="$seen_heads ^$rh"
[ -z "$c" ] && {
- log $h
+ plog '%-20s %7d' $t 0
+ [ "$prev" ] &&
+ plog ' %+7d' $((0 - prev_num))
+ plog '\n'
continue
}
is=$(patch_and_sha_ids $c)
# is=$(join -v 1 <(echo "$is") <(echo "$origin_ids"))
- is=$(join -v 1 <(echo "$is") ../origin1.ids)
+ is=$(echo "$is" | join -v 1 - "../stats/origin1-$d.ids")
is=$(join -v 1 <(echo "$is") <(echo "$seen_ids"))
c1=$(echo "$is" | cut -d' ' -f2)
- [ "$is" ] && seen_ids=$( (echo "$seen_ids"; echo "$is" | cut -d' ' -f1) | sort)
-
- log $h \($(echo "$c" | wc -w) $(echo "$c1" | wc -w)\)
+ [ "$is" ] &&
+ seen_ids=$( (echo "$seen_ids"; echo "$is" | cut -d' ' -f1) | sort)
seen_sha1s="$seen_sha1s $c1"
+
+# log $t \($(echo "$c" | wc -w) $(echo "$c1" | wc -w)\)
+ num=$(echo "$c1" | wc -w)
+ plog '%-20s %7d' $t $num
+ [ "$prev" ] &&
+ plog ' %+7d' $((num - prev_num))
+ plog '\n'
done
log