Using the FreeBSD SVN repo for fun and profit

From FBSD_tips

Jump to: navigation, search

Contents

[edit] Description

FreeBSD's move to Subversion for the src repository, has opened up some interesting and unique tricks for getting the most out of the repository. This page is intended as a tip/tricks playground for people who are using the svn repository in interesting ways.

[edit] Gaining context when dealing with revisions

Subversion has a feature called 'blame' which allows you to view which user, and at what revision, a line in a file was last edited.

For example, here is the start of Makefile.inc1:

 38666         jb #
 50479      peter # $FreeBSD$
 38666         jb #
 38666         jb # Make command line options:
139122         ru #    -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
139122         ru #    -DNO_CLEAN do not clean at all
139120         ru #    -DNO_SHARE do not go into share subdir
 61703      brian #    -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
 71401      peter #    -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
 61703      brian #    -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
 64340   sheldonh #    -DNO_PORTSUPDATE do not update ports in ${MAKE} update
 64340   sheldonh #    -DNO_DOCUPDATE do not update doc in ${MAKE} update
179233         jb #    -DNO_CTF do not run the DTrace CTF conversion tools on built objects
 38666         jb #    LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
162113         ru #    TARGET="machine" to crossbuild world for a different machine type
 38666         jb 
 38666         jb #
 38666         jb # The intended user-driven targets are:
 38666         jb # buildworld  - rebuild *everything*, including glue to help do upgrades
 38666         jb # installworld- install everything built by "buildworld"

Unfortunately, 'revision' is not a useful marker, so to help, I've put together a list of revisions, release number, and date, to help give a revision context. In this way, you can get an approximation of the date a specific line was added, and which releases it may affect.

[edit] Revision Table

Release SVN Revision Date and Time
2.0.5 9201 1995-06-10 154455 -0400 (Sat, 10 Jun 1995)
2.1.0 13149 1996-01-01 060115 -0500 (Mon, 01 Jan 1996)
2.1.5 18741 1996-10-06 035804 -0400 (Sun, 06 Oct 1996)
2.1.6.1 22270 1997-02-04 232955 -0500 (Tue, 04 Feb 1997)
2.1.6 22271 1997-02-04 232956 -0500 (Tue, 04 Feb 1997)
2.1.7 23636 1997-03-10 190801 -0500 (Mon, 10 Mar 1997)
2.2.0 23959 1997-03-16 230504 -0500 (Sun, 16 Mar 1997)
2.2.1 24318 1997-03-26 220727 -0500 (Wed, 26 Mar 1997)
2.2.2 25920 1997-05-19 063555 -0400 (Mon, 19 May 1997)
2.2.5 30619 1997-10-20 215605 -0400 (Mon, 20 Oct 1997)
2.2.6 34878 1998-03-24 060004 -0500 (Tue, 24 Mar 1998)
2.2.7 37853 1998-07-24 005732 -0400 (Fri, 24 Jul 1998)
2.2.8 42950 1999-01-20 195530 -0500 (Wed, 20 Jan 1999)
3.0.0 42952 1999-01-20 195532 -0500 (Wed, 20 Jan 1999)
3.1.0 44077 1999-02-15 205946 -0500 (Mon, 15 Feb 1999)
3.2.0 47463 1999-05-24 124710 -0400 (Mon, 24 May 1999)
3.3.0 51330 1999-09-16 042613 -0400 (Thu, 16 Sep 1999)
3.4.0 54856 1999-12-19 191649 -0500 (Sun, 19 Dec 1999)
4.0.0 58337 2000-03-20 034753 -0500 (Mon, 20 Mar 2000)
3.5.0 62044 2000-06-24 202049 -0400 (Sat, 24 Jun 2000)
4.1.0 63895 2000-07-26 171235 -0400 (Wed, 26 Jul 2000)
4.1.1 66373 2000-09-25 175754 -0400 (Mon, 25 Sep 2000)
4.2.0 68931 2000-11-19 234145 -0500 (Sun, 19 Nov 2000)
4.3.0 75774 2001-04-21 015002 -0400 (Sat, 21 Apr 2001)
4.4.0 90218 2002-02-04 142343 -0500 (Mon, 04 Feb 2002)
4.5.0 90220 2002-02-04 142345 -0500 (Mon, 04 Feb 2002)
4.6.0 99349 2002-07-03 090143 -0400 (Wed, 03 Jul 2002)
4.6.1 100367 2002-07-19 125944 -0400 (Fri, 19 Jul 2002)
4.6.2 101859 2002-08-14 025709 -0400 (Wed, 14 Aug 2002)
4.7.0 104664 2002-10-08 013908 -0400 (Tue, 08 Oct 2002)
5.0.0 109388 2003-01-16 115623 -0500 (Thu, 16 Jan 2003)
4.8.0 113029 2003-04-03 134923 -0500 (Thu, 03 Apr 2003)
5.1.0 115838 2003-06-04 120027 -0400 (Wed, 04 Jun 2003)
4.9.0 121611 2003-10-27 025733 -0500 (Mon, 27 Oct 2003)
5.2.0 124330 2004-01-10 005329 -0500 (Sat, 10 Jan 2004)
5.2.1 126167 2004-02-23 103256 -0500 (Mon, 23 Feb 2004)
4.10.0 129723 2004-05-25 114751 -0400 (Tue, 25 May 2004)
5.3.0 137220 2004-11-04 141242 -0500 (Thu, 04 Nov 2004)
4.11.0 140576 2005-01-21 081242 -0500 (Fri, 21 Jan 2005)
5.4.0 145987 2005-05-07 135110 -0400 (Sat, 07 May 2005)
6.0.0 151988 2005-11-02 193526 -0500 (Wed, 02 Nov 2005)
6.1.0 158336 2006-05-06 152414 -0400 (Sat, 06 May 2006)
5.5.0 158848 2006-05-23 000912 -0400 (Tue, 23 May 2006)
6.2.0 165962 2007-01-11 175446 -0500 (Thu, 11 Jan 2007)
6.3.0 175357 2008-01-15 104622 -0500 (Tue, 15 Jan 2008)
7.0.0 176506 2008-02-24 004517 -0500 (Sun, 24 Feb 2008)

[edit] Using the SVN repo as though it was a filesystem

If you install fusefs-wdfs from ports, you have an option available to you which can become surprisingly useful.

Normally, to do HEAD to -STABLE, or HEAD to -RELEASE, comparisions or merging, it was required to have a copy of the repo locally, or do it on freefall. However, this takes a lot of disk space, and even more so for svn then with cvs.

But, you can mount the subversion repository into your filesystem, which takes up no disk space, and less bandwidth then a full cvs mirror used to.

it's as simple as:

wdfs http://svn.freebsd.org/base/ directory

I currently have it mounted in my ~/freebsd directory. this allows me to do

diff ~/freebsd/head/sys/dev/ata/atapi-cd.c ~/freebsd/release/7.0.0/sys/dev/ata/atapi-cd.c

to look at the changes made to HEAD since 7.0.0 was released.

cd ~/freebsd/head/ && tar -cf - * | tar -xf - -C /usr/src

to do a quick 'checkout' of head (note this is not recommended, use svn co as it preserves attributes better then wdfs)

or, to test a subsection of the repo:

mount -t nullfs -o ro ~/freebsd/head/usr.sbin/authpf/ /usr/src/usr.sbin/authpf/

Note that you can do everything you could normally do on a read-only filesystem, so use your imagination.

The only restriction is that the .svn metadata is not exported in a way that the subversion ports can understand. So commands such as svnversion or svn blame will not work.

Personal tools