NetBSD-5.0.2/sbin/mount_portal/examples/cvs.1

The cvs.conf portal configuration file maps the NetBSD anoncvs
respository into the local file system.  This means you can cat(1)
or cp(1) copies of any arbitrary file or revision from the cvs
server using a local path.  Start off like this:

	# mkdir /p
	# mount -t portal `pwd`/cvs.conf /p
	#

The next step is to set up the authentication.  The NetBSD anoncvs
server uses ssh for authentication, so all you need to do is

	# ssh anoncvs@anoncvs.NetBSD.org

and answer 'yes' when it asks you if you want to accept the key.
Now the NetBSD source tree is close at hand.

First, some caveats.  File name completion and globbing don't work,
and diff has difficulties with this since it stat()s the file names
it's given and gets back more or less meaningless information for
names under a portal file system.

Here's a list of things I've done with this:

1) diff one of my files (eg, /etc/security) against the repository

	% grep NetBSD: /etc/security
	#	$NetBSD: security,v 1.52 ...
	% diff -u -< /p/netbsd/src/etc/security,1.52 /etc/security
	[ diffs elided ]
	%

Notice the use of the - file given to diff and the input redirection
so that it will read from stdin instead of opening the file itself.
This gets around the stat() problem.

2) Check out some (or all) versions of a file:

	% grep NetBSD: /etc/security
	#	$NetBSD: security,v 1.52 ...
	% foreach i (`jot 10 43`)
	> cp /p/netbsd/src/etc/security,1.$i /tmp
	> end
	%

Presto!  Versions 1.43 through 1.52 (jot(1) prints 10 numbers
starting at 43) of /etc/security are copied into your /tmp directory
so that you can do arbitrary diffs between any version you like.
You can use tags instead of revision numbers if you like.

3) Instant upgrades.  Since cvs always defaults to the head of the
trunk, you can do this:

	# cp /p/netbsd/src/etc/security /etc/security
	#

to upgrade to the latest and greatest version any time you like,
or you can do this:

	# uname -r
	1.5.2
	# cp /p/netbsd/src/etc/security,netbsd-1-5-PATCH002 /etc/security
	#

to get rid of any changes you might have made to /etc/security that
you no longer want.

Note that there's some support for the FreeBSD and OpenBSD anoncvs
service in there as well, but those might be tricky.  The FreeBSD
anoncvs server only offers pserver access, so you'll need to manually
do a cvs login to make that work.  The OpenBSD server seems to move
around a fair amount, so the CVSROOT value for it will need to be
updated if that happens again.  You might also choose to use
different servers entirely.