forked from jon-turney/google-breakpad-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetch-svn-externals
executable file
·47 lines (37 loc) · 1.2 KB
/
fetch-svn-externals
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python
#
# Read a depot_tools style DEPS file and recursively checkout the svn externals
# listed
#
import os
# required to make some DEPS files syntactically valid
def Var(var_name):
return '%s'
def system(cmd):
print cmd
os.system(cmd)
def checkout_deps(basepath):
depsfile = os.path.join(basepath, 'DEPS')
if not os.path.exists(depsfile):
print 'Nothing to do for', depsfile
return
print 'Processing deps in', depsfile
# evaluate contents of DEPS file
f = open(depsfile, 'r')
exec(f)
# process the path:svnurl pairs in deps
for path in deps.keys():
src = deps[path]
(url, rev) = src.split('@')
if path.startswith('src/'):
path = path[4:]
print '%s %s %s' % (url, path, rev)
if not os.path.exists(os.path.join(path, '.git')):
system('git svn clone -q %s %s -r %s' % (url, path, rev))
else:
system('cd %s; git svn fetch -q -r %s' % (path, rev))
system('cd %s; git reset --hard $(git svn find-rev r%s)' % (path, rev))
# and recurse
checkout_deps(os.path.join(basepath, path))
print 'Done processing of', depsfile
checkout_deps('.')