Plan 9 from Bell Labs’s /usr/web/sources/contrib/dho/vcs/init

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


#!/bin/rc

fn usage {
	echo 'usage: vcs/init directory' >[1=2]
	echo '	directory:  root repository directory to initialize' >[1=2]
	exit 0
}

fn f { du -a $* | sed 's/^.*	//g' }

#
# For (as yet) nonexistent $changelog and others
#
#if(test -e $home/lib/vcsconfig) {
#	. $home/lib/vcsconfig
#}

if (! ~ $#* 1) {
	usage
}

if (! test -d $1) {
	usage
}

initdir=$*(1)
pwd=`{pwd}
rootpath=$pwd/$initdir

for (i in `{f $initdir}) {
	if (test -d $i) {
		echo Setting up vcs structure in $i...
		mkdir $i/.vcs
		echo $rootpath > $i/.vcs/root
	}
}

mkdir $rootpath/.commits
echo 0 > $rootpath/.commits/.N

touch $rootpath/.lock
chmod +l $rootpath/.lock

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.