1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-07-05 02:58:34 +03:00

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
This commit is contained in:
Werner Almesberger 2010-08-27 19:32:52 -03:00
parent 627d7d790b
commit d7d95ff2da
3 changed files with 49 additions and 12 deletions

View File

@ -1,9 +1,31 @@
.PHONY: all ben-wpan-schhist
SHELL = /bin/bash
.PHONY: all ben-wpan-schhist xue-schhist
# All the targets are for demo purposes pnly !
all:
@echo "possible targets:" 2>&1
@echo " ben-wpan-schhist ben-wpan-schhist-upload" 2>&1
@echo " xue-schhist xue-schhist-upload" 2>&1
@exit 1
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
ben-wpan-schhist-upload:
rsync -a --progress _out/{index.html,unchanged.png,thum*,diff*} \
werner@host:/home/httpd/almesberger/misc/ben/demo/
xue-schhist:
SCHHIST_TITLE=Xue \
SCHHIST_HOME_URL=http://projects.qi-hardware.com/index.php/p/xue/ \
SCHHIST_COMMIT_TEMPLATE='http://projects.qi-hardware.com/index.php/p/xue/source/commit/{}/' \
./schhist2web ../../xue kicad/xue-rnc/xue-rnc.sch _xue
xue-schhist-upload:
rsync -a --progress _xue/{index.html,unchanged.png,thum*,diff*} \
werner@host:/home/httpd/almesberger/misc/ben/demo2/

View File

@ -14,15 +14,30 @@
usage()
{
echo "usage: $0 path" 2>&1
cat <<EOF 2>&1
usage: $0 repo-dir path
The file to trace must be at repo-dir/path
EOF
exit 1
}
[ -z "$1" -o ! -z "$2" ] && usage
[ ! -f "$1" ] && usage
if [ -z "$2" -o ! -z "$3" ]; then
usage
fi
git log --follow --name-status "$1" |
if [ ! -d "$1" -o ! -d "$1/.git" ]; then
echo "no git repository at $1" 1>&2
exit 1
fi
if [ ! -f "$1/$2" ]; then
echo "cannot find $2" 2>&1
exit 1
fi
cd "$1" || exit
git log --follow --name-status "$2" |
awk '
/^commit /{ if (c) print c, n; c = $2 }
{ if (NF) n = $(NF) }

View File

@ -114,8 +114,8 @@ fi
[ -z "$1" ] || usage
PATH=`dirname "$0"`:"$PATH"
first=`gitenealogy "$dir/$sch" | sed '$s/ .*//p;d'`
schname=`gitenealogy "$dir/$sch" | sed '$s/^.* //p;d'`
first=`gitenealogy "$dir" "$sch" | sed '$s/ .*//p;d'`
schname=`gitenealogy "$dir" "$sch" | sed '$s/^.* //p;d'`
rm -rf "$out/diff_*" "$out/thumb_*" "$out/names"
$no_cache && rm -rf "$cache"
@ -123,11 +123,11 @@ mkdir -p "$out/names"
mkdir -p "$cache"
head=
for n in $first `git rev-list --reverse $first..HEAD`; do
git show --pretty=format:'' --name-only $n |
for n in $first `cd "$dir" && git rev-list --reverse $first..HEAD`; do
( cd "$dir" && git show --pretty=format:'' --name-only $n; ) |
egrep -q '\.sch$|\.pro$|\.lib$' || continue
echo Processing $n
new=`gitenealogy "$dir/$sch" | sed "/^$n /s///p;d"`
new=`gitenealogy "$dir" "$sch" | sed "/^$n /s///p;d"`
if [ ! -z "$new" ]; then
echo Name change $schname to $new 1>&2
schname="$new"
@ -181,7 +181,7 @@ EOF
} >"$index"
next="$head"
for n in `git rev-list $first..HEAD~1` $first; do
for n in `cd "$dir" && git rev-list $first..HEAD~1` $first; do
[ -d "$cache/ppm_$n" ] || continue
empty=true
s="<TR><TR>"
@ -229,7 +229,7 @@ $s<TD valign="middle">
EOF
mkdir -p "$out/diff_$next" "$out/thumb_$next"
echo "<PRE>"
git log --pretty=short $next~1..$next |
( cd "$dir" && git log --pretty=short $next~1..$next; ) |
if [ -z "$SCHHIST_COMMIT_TEMPLATE" ]; then
cat
else