OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env 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 # Copyright (C) 2008 Evan Martin <martine@danga.com> | 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> |
7 | 7 |
8 """A git-command for integrating reviews on Rietveld.""" | 8 """A git-command for integrating reviews on Rietveld.""" |
9 | 9 |
10 from distutils.version import LooseVersion | 10 from distutils.version import LooseVersion |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 333 |
334 if url: | 334 if url: |
335 svn_remote_re = re.compile(r'^svn-remote\.([^.]+)\.url (.*)$') | 335 svn_remote_re = re.compile(r'^svn-remote\.([^.]+)\.url (.*)$') |
336 remotes = RunGit(['config', '--get-regexp', | 336 remotes = RunGit(['config', '--get-regexp', |
337 r'^svn-remote\..*\.url']).splitlines() | 337 r'^svn-remote\..*\.url']).splitlines() |
338 for remote in remotes: | 338 for remote in remotes: |
339 match = svn_remote_re.match(remote) | 339 match = svn_remote_re.match(remote) |
340 if match: | 340 if match: |
341 remote = match.group(1) | 341 remote = match.group(1) |
342 base_url = match.group(2) | 342 base_url = match.group(2) |
| 343 rewrite_root = RunGit( |
| 344 ['config', 'svn-remote.%s.rewriteRoot' % remote], |
| 345 error_ok=True).strip() |
| 346 if rewrite_root: |
| 347 base_url = rewrite_root |
343 fetch_spec = RunGit( | 348 fetch_spec = RunGit( |
344 ['config', 'svn-remote.%s.fetch' % remote], | 349 ['config', 'svn-remote.%s.fetch' % remote], |
345 error_ok=True).strip() | 350 error_ok=True).strip() |
346 if fetch_spec: | 351 if fetch_spec: |
347 self.svn_branch = MatchSvnGlob(url, base_url, fetch_spec, False) | 352 self.svn_branch = MatchSvnGlob(url, base_url, fetch_spec, False) |
348 if self.svn_branch: | 353 if self.svn_branch: |
349 break | 354 break |
350 branch_spec = RunGit( | 355 branch_spec = RunGit( |
351 ['config', 'svn-remote.%s.branches' % remote], | 356 ['config', 'svn-remote.%s.branches' % remote], |
352 error_ok=True).strip() | 357 error_ok=True).strip() |
(...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2347 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 2352 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
2348 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 2353 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
2349 | 2354 |
2350 | 2355 |
2351 if __name__ == '__main__': | 2356 if __name__ == '__main__': |
2352 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2357 # These affect sys.stdout so do it outside of main() to simplify mocks in |
2353 # unit testing. | 2358 # unit testing. |
2354 fix_encoding.fix_encoding() | 2359 fix_encoding.fix_encoding() |
2355 colorama.init() | 2360 colorama.init() |
2356 sys.exit(main(sys.argv[1:])) | 2361 sys.exit(main(sys.argv[1:])) |
OLD | NEW |