Plan 9 from Bell Labs’s /usr/web/sources/contrib/gabidiaz/root/rc/bin/gsvn

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc

infernosvn='http://inferno-os.googlecode.com/svn/trunk'


fn getdir {
	rev=`{hget $1 | htmlfmt -a -l 1000 | grep Revision |awk '{print $2}' | sed 's/://g'}
	if ( test -r $rev ) { update=no; echo $1^':'^$rev^':Update not needed'}
	if not { update=yes; echo $1^':'^$rev^': Updating'}

	ls=`{hget $1 | htmlfmt -a -l 1000 | awk '{print $2}'  | sed 's/[\[\]]//g' |  sed '/^$/d' | sed '/\.\.\//d' | sed '/:$/d'} 

	for (f in $ls) {
		name=`{basename $f}
		dir=`{basename -d $f | sed '/\./d'}
		if (test $dir) {
			mkdir -p $dir
			cd $dir
			getdir $1^'/'^$dir
			cd ..
		}
		if (test $name) {
			if (~ $update yes) {
					hget -o $name $1^'/'^$name  >/dev/null >[2=1]
			}
		}
	}
	if (~ $update yes) { touch $rev }
}

if(! ~ $#* 1) {
	echo usage:
	echo '	gsvn [ site | http://project.googlecode.com/svn/trunk ]'
	exit
}

switch($1){
case inferno
	getdir $infernosvn
	exit
case *
	getdir $1
	exit
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.