From 627d7d790beaea78daccda52d57ffcd08b482bf5 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Fri, 27 Aug 2010 15:39:39 -0300 Subject: [PATCH] Add links to project page and commit. Put placeholder if sheet doesn't change. - scripts/schhist2web: show a vertial dash in places where a sheet didn't change - scripts/schhist2web: new environment variable SCHHIST_TITLE to set the title - scripts/schhist2web: new environment variable SCHHIST_HOME_URL for the URL the title links to - scripts/schhist2web: new environment variable SCHHIST_COMMIT_TEMPLATE for a template to link to the commit ({} gets replaced with the hash) - scripts/Makefile: schematics history build example for ben-wpan/atrf - scripts/schhist2web: at the very end, don't exit 1 on success --- scripts/Makefile | 9 +++++++++ scripts/schhist2web | 42 +++++++++++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 scripts/Makefile diff --git a/scripts/Makefile b/scripts/Makefile new file mode 100644 index 0000000..4c4d6a7 --- /dev/null +++ b/scripts/Makefile @@ -0,0 +1,9 @@ +.PHONY: all ben-wpan-schhist + +all: + +ben-wpan-schhist: + SCHHIST_TITLE=ben-wpan/atrf \ + SCHHIST_HOME_URL=http://projects.qi-hardware.com/index.php/p/ben-wpan/ \ + SCHHIST_COMMIT_TEMPLATE='http://projects.qi-hardware.com/index.php/p/ben-wpan/source/commit/{}/' \ + ./schhist2web atrf/wpan-atrf.sch diff --git a/scripts/schhist2web b/scripts/schhist2web index 740afe5..9fb7019 100755 --- a/scripts/schhist2web +++ b/scripts/schhist2web @@ -152,17 +152,33 @@ if [ -z "$head" ]; then exit 1 fi +ppmmake '#e0e0e0' 5 20 | pnmtopng >"$out"/unchanged.png + index="$out/index.html" -cat <"$index" +{ + cat < - +EOF + if [ ! -z "$SCHHIST_TITLE" ]; then + echo "$SCHHIST_TITLE" + fi + echo "" + if [ ! -z "$SCHHIST_TITLE" ]; then + echo "

" + [ -z "$SCHHIST_HOME_URL" ] || echo "" + echo "$SCHHIST_TITLE" + [ -z "$SCHHIST_HOME_URL" ] || echo "" + echo "

" + fi + cat < EOF -for m in `ls -1 "$out/names"`; do - echo "$m" >>"$index" -done + for m in `ls -1 "$out/names"`; do + echo "$m" + done +} >"$index" next="$head" for n in `git rev-list $first..HEAD~1` $first; do @@ -179,8 +195,11 @@ for n in `git rev-list $first..HEAD~1` $first; do thumb="$out/thumb_$next/$m.png" if [ -f "$a" -a -f "$b" ]; then - s="$s" - pngdiff cat "$diff" "$a" "$b" || continue + s="$s" + if ! pngdiff cat "$diff" "$a" "$b"; then + s="$s" git log --pretty=short $next~1..$next | - sed 's/&/&/g;s//\>/g' + if [ -z "$SCHHIST_COMMIT_TEMPLATE" ]; then + cat + else + url=`echo "$SCHHIST_COMMIT_TEMPLATE" | sed "s/{}/$next/g"` + sed "s|^commit |commit |" + fi | + sed '/^<.*>commit/\>/g' echo "" ) >>"$index" fi @@ -225,4 +250,3 @@ cat <>"$index" EOF -exit 1