Date:2010-08-28 00:32:52 (8 years 10 months ago)
Author:Werner Almesberger
Commit:d7d95ff2da07c37cd95d5466d7cd2b775c771ec8
Message:Allow schhist2web and friends to run from a directory outside the working tree.

- scripts/gitenealogy: now requires the repository directory to be passed
- scripts/schhist2web: adapted for above change
- scripts/schhist2web: change to the repository's directory before each
call to git
- scripts/Makefile: added demo upload and Xue build
- scripts/Makefile (all): added usage information
Files: scripts/Makefile (1 diff)
scripts/gitenealogy (1 diff)
scripts/schhist2web (4 diffs)

Change Details

scripts/Makefile
1.PHONY: all ben-wpan-schhist
1SHELL = /bin/bash
2
3.PHONY: all ben-wpan-schhist xue-schhist
4
5# All the targets are for demo purposes pnly !
26
37all:
8        @echo "possible targets:" 2>&1
9        @echo " ben-wpan-schhist ben-wpan-schhist-upload" 2>&1
10        @echo " xue-schhist xue-schhist-upload" 2>&1
11        @exit 1
412
513ben-wpan-schhist:
614    SCHHIST_TITLE=ben-wpan/atrf \
715      SCHHIST_HOME_URL=http://projects.qi-hardware.com/index.php/p/ben-wpan/ \
816      SCHHIST_COMMIT_TEMPLATE='http://projects.qi-hardware.com/index.php/p/ben-wpan/source/commit/{}/' \
917      ./schhist2web atrf/wpan-atrf.sch
18
19ben-wpan-schhist-upload:
20     rsync -a --progress _out/{index.html,unchanged.png,thum*,diff*} \
21       werner@host:/home/httpd/almesberger/misc/ben/demo/
22
23xue-schhist:
24    SCHHIST_TITLE=Xue \
25      SCHHIST_HOME_URL=http://projects.qi-hardware.com/index.php/p/xue/ \
26      SCHHIST_COMMIT_TEMPLATE='http://projects.qi-hardware.com/index.php/p/xue/source/commit/{}/' \
27      ./schhist2web ../../xue kicad/xue-rnc/xue-rnc.sch _xue
28
29xue-schhist-upload:
30     rsync -a --progress _xue/{index.html,unchanged.png,thum*,diff*} \
31       werner@host:/home/httpd/almesberger/misc/ben/demo2/
scripts/gitenealogy
1414
1515usage()
1616{
17    echo "usage: $0 path" 2>&1
17    cat <<EOF 2>&1
18usage: $0 repo-dir path
19
20  The file to trace must be at repo-dir/path
21EOF
1822    exit 1
1923}
2024
2125
22[ -z "$1" -o ! -z "$2" ] && usage
23[ ! -f "$1" ] && usage
26if [ -z "$2" -o ! -z "$3" ]; then
27    usage
28fi
29
30if [ ! -d "$1" -o ! -d "$1/.git" ]; then
31    echo "no git repository at $1" 1>&2
32    exit 1
33fi
34if [ ! -f "$1/$2" ]; then
35    echo "cannot find $2" 2>&1
36    exit 1
37fi
2438
25git log --follow --name-status "$1" |
39cd "$1" || exit
40git log --follow --name-status "$2" |
2641    awk '
2742/^commit /{ if (c) print c, n; c = $2 }
2843{ if (NF) n = $(NF) }
scripts/schhist2web
114114[ -z "$1" ] || usage
115115
116116PATH=`dirname "$0"`:"$PATH"
117first=`gitenealogy "$dir/$sch" | sed '$s/ .*//p;d'`
118schname=`gitenealogy "$dir/$sch" | sed '$s/^.* //p;d'`
117first=`gitenealogy "$dir" "$sch" | sed '$s/ .*//p;d'`
118schname=`gitenealogy "$dir" "$sch" | sed '$s/^.* //p;d'`
119119
120120rm -rf "$out/diff_*" "$out/thumb_*" "$out/names"
121121$no_cache && rm -rf "$cache"
...... 
123123mkdir -p "$cache"
124124
125125head=
126for n in $first `git rev-list --reverse $first..HEAD`; do
127    git show --pretty=format:'' --name-only $n |
126for n in $first `cd "$dir" && git rev-list --reverse $first..HEAD`; do
127    ( cd "$dir" && git show --pretty=format:'' --name-only $n; ) |
128128      egrep -q '\.sch$|\.pro$|\.lib$' || continue
129129    echo Processing $n
130    new=`gitenealogy "$dir/$sch" | sed "/^$n /s///p;d"`
130    new=`gitenealogy "$dir" "$sch" | sed "/^$n /s///p;d"`
131131    if [ ! -z "$new" ]; then
132132    echo Name change $schname to $new 1>&2
133133    schname="$new"
...... 
181181} >"$index"
182182
183183next="$head"
184for n in `git rev-list $first..HEAD~1` $first; do
184for n in `cd "$dir" && git rev-list $first..HEAD~1` $first; do
185185    [ -d "$cache/ppm_$n" ] || continue
186186    empty=true
187187    s="<TR><TR>"
...... 
229229EOF
230230    mkdir -p "$out/diff_$next" "$out/thumb_$next"
231231        echo "<PRE>"
232        git log --pretty=short $next~1..$next |
232        ( cd "$dir" && git log --pretty=short $next~1..$next; ) |
233233          if [ -z "$SCHHIST_COMMIT_TEMPLATE" ]; then
234234        cat
235235          else

Archive Download the corresponding diff file



interactive