OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 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 """ | 6 """ |
7 Tool to perform checkouts in one easy command line! | 7 Tool to perform checkouts in one easy command line! |
8 | 8 |
9 Usage: | 9 Usage: |
10 fetch <config> [--property=value [--property2=value2 ...]] | 10 fetch <config> [--property=value [--property2=value2 ...]] |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 super(GclientGitSvnCheckout, self).init() | 175 super(GclientGitSvnCheckout, self).init() |
176 | 176 |
177 # Configure git-svn. | 177 # Configure git-svn. |
178 for path, svn_spec in git_svn_dirs.iteritems(): | 178 for path, svn_spec in git_svn_dirs.iteritems(): |
179 real_path = os.path.join(*path.split('/')) | 179 real_path = os.path.join(*path.split('/')) |
180 if real_path != self.root: | 180 if real_path != self.root: |
181 real_path = os.path.join(self.root, real_path) | 181 real_path = os.path.join(self.root, real_path) |
182 wd = os.path.join(self.base, real_path) | 182 wd = os.path.join(self.base, real_path) |
183 if self.options.dry_run: | 183 if self.options.dry_run: |
184 print 'cd %s' % wd | 184 print 'cd %s' % wd |
185 if svn_spec.get('auto'): | |
186 self.run_git('auto-svn', cwd=wd) | |
187 continue | |
188 self.run_git('svn', 'init', svn_spec['svn_url'], cwd=wd) | 185 self.run_git('svn', 'init', svn_spec['svn_url'], cwd=wd) |
189 self.run_git('config', '--unset-all', 'svn-remote.svn.fetch', cwd=wd) | 186 self.run_git('config', '--unset-all', 'svn-remote.svn.fetch', cwd=wd) |
190 for svn_branch, git_ref in svn_spec.get('git_svn_fetch', {}).items(): | 187 for svn_branch, git_ref in svn_spec.get('git_svn_fetch', {}).items(): |
191 self.run_git('config', '--add', 'svn-remote.svn.fetch', | 188 self.run_git('config', '--add', 'svn-remote.svn.fetch', |
192 '%s:%s' % (svn_branch, git_ref), cwd=wd) | 189 '%s:%s' % (svn_branch, git_ref), cwd=wd) |
193 for svn_branch, git_ref in svn_spec.get('git_svn_branches', {}).items(): | 190 for svn_branch, git_ref in svn_spec.get('git_svn_branches', {}).items(): |
194 self.run_git('config', '--add', 'svn-remote.svn.branches', | 191 self.run_git('config', '--add', 'svn-remote.svn.branches', |
195 '%s:%s' % (svn_branch, git_ref), cwd=wd) | 192 '%s:%s' % (svn_branch, git_ref), cwd=wd) |
196 self.run_git('svn', 'fetch', cwd=wd) | 193 self.run_git('svn', 'fetch', cwd=wd) |
197 | 194 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 spec, root = run_config_fetch(config, props) | 344 spec, root = run_config_fetch(config, props) |
348 return run(options, spec, root) | 345 return run(options, spec, root) |
349 | 346 |
350 | 347 |
351 if __name__ == '__main__': | 348 if __name__ == '__main__': |
352 try: | 349 try: |
353 sys.exit(main()) | 350 sys.exit(main()) |
354 except KeyboardInterrupt: | 351 except KeyboardInterrupt: |
355 sys.stderr.write('interrupted\n') | 352 sys.stderr.write('interrupted\n') |
356 sys.exit(1) | 353 sys.exit(1) |
OLD | NEW |