Skip to content

Instantly share code, notes, and snippets.

@mcfearsome
Created October 19, 2008 03:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mcfearsome/17772 to your computer and use it in GitHub Desktop.
Save mcfearsome/17772 to your computer and use it in GitHub Desktop.
import os
from string import Template
tmpl = Template("git-svn clone $repo $folder")
def getCommandOutput(command):
child = os.popen(command)
data = child.read()
err = child.close()
if err:
raise RuntimeError, '%s failed w/ exit code %d' % (command, err)
return data
def get_externals():
commands = []
cmd_output = []
externals_file = open('svn.externals','r')
for line in externals_file.readlines():
parts = line.split(" ")
d = dict(repo=parts[1].replace("\n",""),folder=parts[0])
commands.append(tmpl.substitute(d))
for cmd in commands:
cmd_output.append(getCommandOutput(cmd))
for output in cmd_output:
print output
if __name__ == '__main__':
get_externals()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment