OLD | NEW |
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 |
| 14 # Used by deps2git.ConvertDepsToGit() as overrides for SVN DEPS. Each entry |
| 15 # maps a DEPS path to a DEPS variable identifying the Git hash for its |
| 16 # respective repository. Variables are automatically transferred from SVN DEPS |
| 17 # to .DEPS.git and converted into variables by deps_utils.Varify(). |
| 18 DEPS_OVERRIDES = { |
| 19 'src/third_party/ffmpeg': 'ffmpeg_hash' |
| 20 } |
| 21 |
| 22 |
17 def SvnUrlToGitUrl(path, svn_url): | 23 def SvnUrlToGitUrl(path, svn_url): |
18 """Convert a chromium SVN URL to a chromium Git URL.""" | 24 """Convert a chromium SVN URL to a chromium Git URL.""" |
19 | 25 |
20 match = re.match('http://src.chromium.org/svn(/.*)', svn_url) | 26 match = re.match('http://src.chromium.org/svn(/.*)', svn_url) |
21 if match: | 27 if match: |
22 svn_url = match.group(1) | 28 svn_url = match.group(1) |
23 | 29 |
24 # A few special cases. | 30 # A few special cases. |
25 if svn_url == '/trunk/deps/page_cycler/acid3': | 31 if svn_url == '/trunk/deps/page_cycler/acid3': |
26 return (path, 'http://git.chromium.org/chromium/deps/acid3.git') | 32 return (path, GIT_HOST + 'chromium/deps/acid3.git') |
27 | 33 |
28 if svn_url == '/trunk/deps/gpu/software_rendering_list': | 34 if svn_url == '/trunk/deps/gpu/software_rendering_list': |
29 return (path, 'http://git.chromium.org/chromium/deps/gpu/software_rendering_
list.git') | 35 return (path, GIT_HOST + 'chromium/deps/gpu/software_rendering_list.git') |
30 | 36 |
31 if svn_url == '/trunk/tools/third_party/python_26': | 37 if svn_url == '/trunk/tools/third_party/python_26': |
32 return (path, 'http://git.chromium.org/chromium/deps/python_26.git') | 38 return (path, GIT_HOST + 'chromium/deps/python_26.git') |
33 | 39 |
34 if svn_url == '/trunk/deps/support': | 40 if svn_url == '/trunk/deps/support': |
35 return (path, 'http://git.chromium.org/chromium/support.git') | 41 return (path, GIT_HOST + 'chromium/support.git') |
36 | 42 |
37 if svn_url == '/trunk/deps/frame_rate/content': | 43 if svn_url == '/trunk/deps/frame_rate/content': |
38 return (path, 'http://git.chromium.org/chromium/frame_rate/content.git') | 44 return (path, GIT_HOST + 'chromium/frame_rate/content.git') |
39 | 45 |
40 if svn_url == 'svn://svn.chromium.org/jsoncpp/trunk/jsoncpp': | 46 if svn_url == 'svn://svn.chromium.org/jsoncpp/trunk/jsoncpp': |
41 return (path, 'http://git.chromium.org/external/jsoncpp/jsoncpp.git') | 47 return (path, GIT_HOST + 'external/jsoncpp/jsoncpp.git') |
| 48 |
| 49 if svn_url == '/trunk/deps/third_party/ffmpeg': |
| 50 return (path, GIT_HOST + 'chromium/third_party/ffmpeg.git') |
42 | 51 |
43 if svn_url in ('http://selenium.googlecode.com/svn/trunk/py/test', | 52 if svn_url in ('http://selenium.googlecode.com/svn/trunk/py/test', |
44 '/trunk/deps/reference_builds/chrome'): | 53 '/trunk/deps/reference_builds/chrome'): |
45 # Those can't be git svn cloned. Skipping for now. | 54 # Those can't be git svn cloned. Skipping for now. |
46 return (None, None) | 55 return (None, None) |
47 | 56 |
48 # Projects on sourceforge using trunk | 57 # Projects on sourceforge using trunk |
49 match = re.match('http?://(.*).svn.sourceforge.net/svnroot/(.*)/trunk(.*)', sv
n_url) | 58 match = re.match('http?://(.*).svn.sourceforge.net/svnroot/(.*)/trunk(.*)', |
| 59 svn_url) |
50 if match: | 60 if match: |
51 repo = '%s%s.git' % (match.group(2), match.group(3)) | 61 repo = '%s%s.git' % (match.group(2), match.group(3)) |
52 return (path, 'http://git.chromium.org/external/%s' % repo) | 62 return (path, GIT_HOST + 'external/%s' % repo) |
53 | 63 |
54 # Projects on googlecode.com using trunk. | 64 # Projects on googlecode.com using trunk. |
55 match = re.match('http?://(.*).googlecode.com/svn/trunk(.*)', svn_url) | 65 match = re.match('http?://(.*).googlecode.com/svn/trunk(.*)', svn_url) |
56 if match: | 66 if match: |
57 repo = '%s%s.git' % (match.group(1), match.group(2)) | 67 repo = '%s%s.git' % (match.group(1), match.group(2)) |
58 return (path, 'http://git.chromium.org/external/%s' % repo) | 68 return (path, GIT_HOST + 'external/%s' % repo) |
59 | 69 |
60 # Projects on googlecode.com usng branches. | 70 # Projects on googlecode.com usng branches. |
61 match = re.match('http://(.*).googlecode.com/svn/branches/(.*)', svn_url) | 71 match = re.match('http://(.*).googlecode.com/svn/branches/(.*)', svn_url) |
62 if match: | 72 if match: |
63 repo = '%s/%s.git' % (match.group(1), match.group(2)) | 73 repo = '%s/%s.git' % (match.group(1), match.group(2)) |
64 return (path, 'http://git.chromium.org/external/%s' % repo) | 74 return (path, GIT_HOST + 'external/%s' % repo) |
65 | 75 |
66 # Projects that are subdirectories of the native_client repository. | 76 # Projects that are subdirectories of the native_client repository. |
67 match = re.match('http://src.chromium.org/native_client/trunk/(.*)', svn_url) | 77 match = re.match('http://src.chromium.org/native_client/trunk/(.*)', svn_url) |
68 if match: | 78 if match: |
69 repo = '%s.git' % match.group(1) | 79 repo = '%s.git' % match.group(1) |
70 return (path, 'http://git.chromium.org/native_client/%s' % repo) | 80 return (path, GIT_HOST + 'native_client/%s' % repo) |
71 | 81 |
72 # Projects that are subdirectories of the chromium/{src,tools} repository. | 82 # Projects that are subdirectories of the chromium/{src,tools} repository. |
73 match = re.match('/trunk/((src|tools)/.*)', svn_url) | 83 match = re.match('/trunk/((src|tools)/.*)', svn_url) |
74 if match: | 84 if match: |
75 repo = '%s.git' % match.group(1) | 85 repo = '%s.git' % match.group(1) |
76 return (path, 'http://git.chromium.org/chromium/%s' % repo) | 86 return (path, GIT_HOST + 'chromium/%s' % repo) |
77 | 87 |
78 # Main webkit directory. | 88 # Main webkit directory. |
79 if svn_url == 'http://svn.webkit.org/repository/webkit/trunk/Source': | 89 if svn_url == 'http://svn.webkit.org/repository/webkit/trunk/Source': |
80 return ('src/third_party/WebKit', | 90 return ('src/third_party/WebKit', |
81 'http://git.chromium.org/external/WebKit_trimmed.git') | 91 GIT_HOST + 'external/WebKit_trimmed.git') |
82 | 92 |
83 # Ignore all webkit directories, since we fetch the whole thing directly. | 93 # Ignore all webkit directories, since we fetch the whole thing directly. |
84 if svn_url == '/trunk/deps/third_party/WebKit': | 94 if svn_url == '/trunk/deps/third_party/WebKit': |
85 return (None, None) | 95 return (None, None) |
86 | 96 |
87 if svn_url.startswith('http://svn.webkit.org'): | 97 if svn_url.startswith('http://svn.webkit.org'): |
88 return (None, None) | 98 return (None, None) |
89 | 99 |
90 # Subdirectories of the chromium deps/third_party directory. | 100 # Subdirectories of the chromium deps/third_party directory. |
91 match = re.match('/trunk/deps/third_party/(.*)', svn_url) | 101 match = re.match('/trunk/deps/third_party/(.*)', svn_url) |
92 if match: | 102 if match: |
93 repo = '%s.git' % match.group(1) | 103 repo = '%s.git' % match.group(1) |
94 return (path, 'http://git.chromium.org/chromium/deps/%s' % repo) | 104 return (path, GIT_HOST + 'chromium/deps/%s' % repo) |
95 | 105 |
96 # Subdirectories of the chromium deps/reference_builds directory. | 106 # Subdirectories of the chromium deps/reference_builds directory. |
97 match = re.match('/trunk/deps/reference_builds/(.*)', svn_url) | 107 match = re.match('/trunk/deps/reference_builds/(.*)', svn_url) |
98 if match: | 108 if match: |
99 repo = '%s.git' % match.group(1) | 109 repo = '%s.git' % match.group(1) |
100 return (path, 'http://git.chromium.org/chromium/reference_builds/%s' % repo) | 110 return (path, GIT_HOST + 'chromium/reference_builds/%s' % repo) |
101 | 111 |
102 # Nothing yet? Oops. | 112 # Nothing yet? Oops. |
103 print "No match for %s" % svn_url | 113 print 'No match for %s' % svn_url |
OLD | NEW |