As of July 2012, FreeBSD uses Subversion as the primary version control system for storing all of FreeBSD’s source code, documentation, and the Ports Collection.
# cd /usr/ports/devel/subversion # make install clean
If the ports tree is not available, Subversion can be installed as a package:
# pkg install devel/subversion
svn checkout https://svn.FreeBSD.org/ports/head /usr/ports
svn-mirror is a URL for one of the Subversion mirror sites.
repository is one of the Project repositories, i.e., base, ports, or doc.
branch depends on the repository used. ports and doc are mostly updated in the head branch, while base maintains the latest version of -CURRENT under head and the respective latest versions of the -STABLE branches under stable/8 (for 8.x), stable/9 (9.x) and stable/10 (10.x).
lwcdir is the target directory where the contents of the specified branch should be placed. This is usually /usr/ports for ports, /usr/src for base, and /usr/doc for doc.
Because the initial checkout has to download the full branch of the remote repository, it can take a while. Please be patient.
After the initial checkout, the local working copy can be updated by running:
# svn update lwcdir
To update /usr/ports created in the example above, use:
# svn update /usr/ports
The update is much quicker than a checkout, only transferring files that have changed.
An alternate way of updating the local working copy after checkout is provided by the Makefile in the /usr/ports, /usr/src, and /usr/doc directories. Set SVN_UPDATE and use the update target. For example, to update /usr/src:
# cd /usr/src # make update SVN_UPDATE=yes