HOWTO: Subversion Export for Legal Discovery

The more interesting things you do in life, the more likely it is that some jackass will sue you. If this happens, you will probably be faced with giving one or more sets of attorneys access to your electronic documents.

If, like all right-thinking citizens, you store your documents in a Subversion repository organized hierarchically by subject, you may find yourself needing to provide access to not only the current version, but all previous versions, of all documents on a particular subject.

With CVS, you could just have made a copy of the relevant part of the repository root, since the repository itself stores things in a directory structure.

But SVN has some nice features like renaming, symlinks, and binary diff, which necessitates a more sophisticated repository structure. You’ll notice that if you go to your repository root, there’s no analog to what you see in CVS.

If you don’t want to give the lawyers your whole SVN repository (and there’s no reason you should), then you need a way to drop out all of the revisions, ever, for a particular directory and all subdirectories.

Here’s what worked for me (using Subversion on Cygwin on Win XP).

$ mkdir /cygdrive/c/temp/discovery $ mkdir /cygdrive/c/temp/discovery/working_copy $ mkdir /cygdrive/c/temp/discovery/repository $ cd doc/all_stuff/ $ cp -par doc/all_stuff/target /cygdrive/c/temp/discovery/working_copy $ svn up -rHEAD target_subject $ svn log target_subject > /cygdrive/c/temp/discovery/repository/log  

Now, look through the log for all of the revisions mentioned. For me they were mercifully few; you may need to do a touch more scripting if you have e.g. hundreds of revisions (think “| grep ‘^r'”).

$  for i in 1 49 103 106 107 112 HEAD > do svn up -r$i target_subject > cp -par target_subject/ /cygdrive/c/temp/discovery/repository/r$i > done $   

This gives a nice, clean structure with your current working copy (including uncommitted changes) in one directory, and all revisions up to that one in another directory, along with the svn log of comments on all commits. This should satisfy all but the most KY-equipped of legal eagles.

Leave a Reply