OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 """Performs all git-svn setup steps necessary for 'git svn dcommit' to work. | 6 """Performs all git-svn setup steps necessary for 'git svn dcommit' to work. |
7 | 7 |
8 Assumes that trunk of the svn remote maps to master of the git remote. | 8 Assumes that trunk of the svn remote maps to master of the git remote. |
9 | 9 |
10 Example: | 10 Example: |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 print 'Checking ', maybe_repo | 76 print 'Checking ', maybe_repo |
77 run_svn('info', maybe_repo) | 77 run_svn('info', maybe_repo) |
78 svn_repo = maybe_repo | 78 svn_repo = maybe_repo |
79 svn_path = '/'.join(path_components[i+1:]) | 79 svn_path = '/'.join(path_components[i+1:]) |
80 break | 80 break |
81 except subprocess2.CalledProcessError: | 81 except subprocess2.CalledProcessError: |
82 continue | 82 continue |
83 assert svn_repo is not None, 'Unable to find svn repo for %s' % match.group(1) | 83 assert svn_repo is not None, 'Unable to find svn repo for %s' % match.group(1) |
84 print 'Found upstream svn repo %s and path %s' % (svn_repo, svn_path) | 84 print 'Found upstream svn repo %s and path %s' % (svn_repo, svn_path) |
85 | 85 |
86 # TODO(kjellander): Remove when WebRTC has moved to Git (crbug.com/435091) | |
87 svn_url = urlparse.urlparse(svn_repo) | |
88 if svn_url.scheme == 'http' and svn_url.hostname.endswith('googlecode.com'): | |
89 svn_repo = svn_repo.replace('http://', 'https://') | |
90 | |
91 set_config('svn-remote.svn.url', svn_repo) | 86 set_config('svn-remote.svn.url', svn_repo) |
92 set_config('svn-remote.svn.fetch', | 87 set_config('svn-remote.svn.fetch', |
93 '%s:refs/remotes/%s' % (svn_path, upstream)) | 88 '%s:refs/remotes/%s' % (svn_path, upstream)) |
94 print 'Configured metadata, running "git svn fetch". This may take some time.' | 89 print 'Configured metadata, running "git svn fetch". This may take some time.' |
95 for line in run_git_stream('svn', 'fetch').xreadlines(): | 90 for line in run_git_stream('svn', 'fetch').xreadlines(): |
96 print line.strip() | 91 print line.strip() |
97 | 92 |
98 | 93 |
99 if __name__ == '__main__': | 94 if __name__ == '__main__': |
100 sys.exit(main(sys.argv)) | 95 sys.exit(main(sys.argv)) |
OLD | NEW |