#!/bin/rc fn usage { echo 'usage: vcs/diff [rev1] [rev2]' >[1=2] exit usage } fn f { du -a $* | awk '{ print $2 }' } if (! ~ $#* 1 2) { usage } if (test -e .vcs/root) { root=`{cat .vcs/root} } if not { echo 'Can''t find root.' >[1=2] exit noroot } if (! test -d $root/.commits/$1) { echo 'Revision 1 doesn''t exist.' >[1=2] exit 'missing rev1' } if (! test -d $root/.commits/$2) { echo 'Revision 2 doesn''t exist.' >[1=2] exit 'missing rev2' } rev1dir=`{echo /n/$user^'vcsdiff'^$1 if (~ $#* 2) { rev2dir=`{echo /n/$user^'vcsdiff'^$2 } if not { rev2dir=$root } vacfs -m $rev1dir $root^'/.commits/'^$1^'/.vac' if (~$#* 2) { vacfs -m $rev2dir $root^'/.commits/'^$2^'/.vac' } tmpfile=/tmp/vcsdiff^$user^$1^'to'^$2 for (i in `{f $rev1dir}) { file=`{echo $i | sed 's,'^$rev1dir^',,'} if (test -e $rev2dir^$file) { diff -c $i $rev2dir^$file } if not { echo $i Deleted } echo $file >> $tmpfile } for (i in `{f $rev2dir}) { file=`{echo $i | sed 's,'^$rev2dir^',,'} grep -s $file $tmpfile if (! ~ $status '') { # Only new files will match this. diff -c /dev/null $i } } rm -f $tmpfile