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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 prefix = upstream.rsplit('/')[0] | 86 prefix = upstream.rsplit('/')[0] |
87 run_git('svn', 'init', '--prefix=%s' % prefix, '-T', svn_path, svn_repo) | 87 set_config('svn-remote.svn.url', svn_repo) |
88 set_config('svn-remote.svn.fetch', | 88 set_config('svn-remote.svn.fetch', |
89 '%s:refs/remotes/%s' % (svn_path, upstream)) | 89 '%s:refs/remotes/%s' % (svn_path, upstream)) |
90 print 'Configured metadata, running "git svn fetch". This may take some time.' | 90 print 'Configured metadata, running "git svn fetch". This may take some time.' |
91 for line in run_git_stream('svn', 'fetch').xreadlines(): | 91 for line in run_git_stream('svn', 'fetch').xreadlines(): |
92 print line.strip() | 92 print line.strip() |
93 | 93 |
94 | 94 |
95 if __name__ == '__main__': | 95 if __name__ == '__main__': |
96 sys.exit(main(sys.argv)) | 96 sys.exit(main(sys.argv)) |
OLD | NEW |