Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: svn_to_git_public.py

Issue 9359045: Add support for non-git-svn repos. Fix syntax errors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/deps2git/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« deps_utils.py ('K') | « deps_utils.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """SVN to GIT mapping for the public Chromium repositories."""
6 7
7 import os
8 import re 8 import re
9 9
10 10
11 import git_tools
12
13
14 GIT_HOST = 'http://git.chromium.org/' 11 GIT_HOST = 'http://git.chromium.org/'
15 12
16 13
17 def SvnUrlToGitUrl(path, svn_url): 14 def SvnUrlToGitUrl(path, svn_url):
18 """Convert a chromium SVN URL to a chromium Git URL.""" 15 """Convert a chromium SVN URL to a chromium Git URL."""
19 16
20 match = re.match('http://src.chromium.org/svn(/.*)', svn_url) 17 match = re.match('http://src.chromium.org/svn(/.*)', svn_url)
21 if match: 18 if match:
22 svn_url = match.group(1) 19 svn_url = match.group(1)
23 20
24 # A few special cases. 21 # A few special cases.
25 if svn_url == '/trunk/deps/page_cycler/acid3': 22 if svn_url == '/trunk/deps/page_cycler/acid3':
26 return (path, 'http://git.chromium.org/chromium/deps/acid3.git') 23 return (path, GIT_HOST + 'chromium/deps/acid3.git')
27 24
28 if svn_url == '/trunk/deps/gpu/software_rendering_list': 25 if svn_url == '/trunk/deps/gpu/software_rendering_list':
29 return (path, 'http://git.chromium.org/chromium/deps/gpu/software_rendering_ list.git') 26 return (path, GIT_HOST + 'chromium/deps/gpu/software_rendering_list.git')
30 27
31 if svn_url == '/trunk/tools/third_party/python_26': 28 if svn_url == '/trunk/tools/third_party/python_26':
32 return (path, 'http://git.chromium.org/chromium/deps/python_26.git') 29 return (path, GIT_HOST + 'chromium/deps/python_26.git')
33 30
34 if svn_url == '/trunk/deps/support': 31 if svn_url == '/trunk/deps/support':
35 return (path, 'http://git.chromium.org/chromium/support.git') 32 return (path, GIT_HOST + 'chromium/support.git')
36 33
37 if svn_url == '/trunk/deps/frame_rate/content': 34 if svn_url == '/trunk/deps/frame_rate/content':
38 return (path, 'http://git.chromium.org/chromium/frame_rate/content.git') 35 return (path, GIT_HOST + 'chromium/frame_rate/content.git')
39 36
40 if svn_url == 'svn://svn.chromium.org/jsoncpp/trunk/jsoncpp': 37 if svn_url == 'svn://svn.chromium.org/jsoncpp/trunk/jsoncpp':
41 return (path, 'http://git.chromium.org/external/jsoncpp/jsoncpp.git') 38 return (path, GIT_HOST + 'external/jsoncpp/jsoncpp.git')
39
40 if svn_url == '/trunk/deps/third_party/ffmpeg':
41 return (path, GIT_HOST + 'chromium/third_party/ffmpeg.git')
42 42
43 if svn_url in ('http://selenium.googlecode.com/svn/trunk/py/test', 43 if svn_url in ('http://selenium.googlecode.com/svn/trunk/py/test',
44 '/trunk/deps/reference_builds/chrome'): 44 '/trunk/deps/reference_builds/chrome'):
45 # Those can't be git svn cloned. Skipping for now. 45 # Those can't be git svn cloned. Skipping for now.
46 return (None, None) 46 return (None, None)
47 47
48 # Projects on sourceforge using trunk 48 # Projects on sourceforge using trunk
49 match = re.match('http?://(.*).svn.sourceforge.net/svnroot/(.*)/trunk(.*)', sv n_url) 49 match = re.match('http?://(.*).svn.sourceforge.net/svnroot/(.*)/trunk(.*)',
50 svn_url)
50 if match: 51 if match:
51 repo = '%s%s.git' % (match.group(2), match.group(3)) 52 repo = '%s%s.git' % (match.group(2), match.group(3))
52 return (path, 'http://git.chromium.org/external/%s' % repo) 53 return (path, GIT_HOST + 'external/%s' % repo)
53 54
54 # Projects on googlecode.com using trunk. 55 # Projects on googlecode.com using trunk.
55 match = re.match('http?://(.*).googlecode.com/svn/trunk(.*)', svn_url) 56 match = re.match('http?://(.*).googlecode.com/svn/trunk(.*)', svn_url)
56 if match: 57 if match:
57 repo = '%s%s.git' % (match.group(1), match.group(2)) 58 repo = '%s%s.git' % (match.group(1), match.group(2))
58 return (path, 'http://git.chromium.org/external/%s' % repo) 59 return (path, GIT_HOST + 'external/%s' % repo)
59 60
60 # Projects on googlecode.com usng branches. 61 # Projects on googlecode.com usng branches.
61 match = re.match('http://(.*).googlecode.com/svn/branches/(.*)', svn_url) 62 match = re.match('http://(.*).googlecode.com/svn/branches/(.*)', svn_url)
62 if match: 63 if match:
63 repo = '%s/%s.git' % (match.group(1), match.group(2)) 64 repo = '%s/%s.git' % (match.group(1), match.group(2))
64 return (path, 'http://git.chromium.org/external/%s' % repo) 65 return (path, GIT_HOST + 'external/%s' % repo)
65 66
66 # Projects that are subdirectories of the native_client repository. 67 # Projects that are subdirectories of the native_client repository.
67 match = re.match('http://src.chromium.org/native_client/trunk/(.*)', svn_url) 68 match = re.match('http://src.chromium.org/native_client/trunk/(.*)', svn_url)
68 if match: 69 if match:
69 repo = '%s.git' % match.group(1) 70 repo = '%s.git' % match.group(1)
70 return (path, 'http://git.chromium.org/native_client/%s' % repo) 71 return (path, GIT_HOST + 'native_client/%s' % repo)
71 72
72 # Projects that are subdirectories of the chromium/{src,tools} repository. 73 # Projects that are subdirectories of the chromium/{src,tools} repository.
73 match = re.match('/trunk/((src|tools)/.*)', svn_url) 74 match = re.match('/trunk/((src|tools)/.*)', svn_url)
74 if match: 75 if match:
75 repo = '%s.git' % match.group(1) 76 repo = '%s.git' % match.group(1)
76 return (path, 'http://git.chromium.org/chromium/%s' % repo) 77 return (path, GIT_HOST + 'chromium/%s' % repo)
77 78
78 # Main webkit directory. 79 # Main webkit directory.
79 if svn_url == 'http://svn.webkit.org/repository/webkit/trunk/Source': 80 if svn_url == 'http://svn.webkit.org/repository/webkit/trunk/Source':
80 return ('src/third_party/WebKit', 81 return ('src/third_party/WebKit',
81 'http://git.chromium.org/external/WebKit_trimmed.git') 82 GIT_HOST + 'external/WebKit_trimmed.git')
82 83
83 # Ignore all webkit directories, since we fetch the whole thing directly. 84 # Ignore all webkit directories, since we fetch the whole thing directly.
84 if svn_url == '/trunk/deps/third_party/WebKit': 85 if svn_url == '/trunk/deps/third_party/WebKit':
85 return (None, None) 86 return (None, None)
86 87
87 if svn_url.startswith('http://svn.webkit.org'): 88 if svn_url.startswith('http://svn.webkit.org'):
88 return (None, None) 89 return (None, None)
89 90
90 # Subdirectories of the chromium deps/third_party directory. 91 # Subdirectories of the chromium deps/third_party directory.
91 match = re.match('/trunk/deps/third_party/(.*)', svn_url) 92 match = re.match('/trunk/deps/third_party/(.*)', svn_url)
92 if match: 93 if match:
93 repo = '%s.git' % match.group(1) 94 repo = '%s.git' % match.group(1)
94 return (path, 'http://git.chromium.org/chromium/deps/%s' % repo) 95 return (path, GIT_HOST + 'chromium/deps/%s' % repo)
95 96
96 # Subdirectories of the chromium deps/reference_builds directory. 97 # Subdirectories of the chromium deps/reference_builds directory.
97 match = re.match('/trunk/deps/reference_builds/(.*)', svn_url) 98 match = re.match('/trunk/deps/reference_builds/(.*)', svn_url)
98 if match: 99 if match:
99 repo = '%s.git' % match.group(1) 100 repo = '%s.git' % match.group(1)
100 return (path, 'http://git.chromium.org/chromium/reference_builds/%s' % repo) 101 return (path, GIT_HOST + 'chromium/reference_builds/%s' % repo)
101 102
102 # Nothing yet? Oops. 103 # Nothing yet? Oops.
103 print "No match for %s" % svn_url 104 print 'No match for %s' % svn_url
OLDNEW
« deps_utils.py ('K') | « deps_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698