Skip to content

Instantly share code, notes, and snippets.

@mlbright
Created August 13, 2009 00:42
Show Gist options
  • Save mlbright/166883 to your computer and use it in GitHub Desktop.
Save mlbright/166883 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# read an svn parent page and export everything
import re
import urllib2
from BeautifulSoup import BeautifulSoup
from subprocess import call
import os
subversion = 'http://subversion.tigris.org/'
parentdir = 'http://svn/repos'
doc = urllib2.urlopen(parentdir + os.sep).read()
soup = BeautifulSoup(doc)
tail = re.compile(r"^[p-z]")
for a in soup('a'):
if a['href'] == subversion:
continue
if not tail.match(a['href']):
continue
repo = os.sep.join([parentdir, a['href']])
exportcmd = "svn export %s" % (repo)
call(exportcmd, shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment