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 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 remote_url = cl.GetGitBaseUrlFromConfig() | 1691 remote_url = cl.GetGitBaseUrlFromConfig() |
1692 if not remote_url: | 1692 if not remote_url: |
1693 if settings.GetIsGitSvn(): | 1693 if settings.GetIsGitSvn(): |
1694 # URL is dependent on the current directory. | 1694 # URL is dependent on the current directory. |
1695 data = RunGit(['svn', 'info'], cwd=settings.GetRoot()) | 1695 data = RunGit(['svn', 'info'], cwd=settings.GetRoot()) |
1696 if data: | 1696 if data: |
1697 keys = dict(line.split(': ', 1) for line in data.splitlines() | 1697 keys = dict(line.split(': ', 1) for line in data.splitlines() |
1698 if ': ' in line) | 1698 if ': ' in line) |
1699 remote_url = keys.get('URL', None) | 1699 remote_url = keys.get('URL', None) |
1700 else: | 1700 else: |
1701 remote = cl.GetRemoteUrl() | 1701 if cl.GetRemoteUrl() and '/' in cl.GetUpstreamBranch(): |
1702 branch = cl.GetUpstreamBranch() | 1702 remote_url = (cl.GetRemoteUrl() + '@' |
1703 if remote and branch: | 1703 + cl.GetUpstreamBranch().split('/')[-1]) |
1704 if 'googlesource' in remote: | |
1705 remote_url = remote + '/+/' + branch.split('/')[-1] | |
1706 else: | |
1707 remote_url = remote + '@' + branch.split('/')[-1] | |
1708 if remote_url: | 1704 if remote_url: |
1709 upload_args.extend(['--base_url', remote_url]) | 1705 upload_args.extend(['--base_url', remote_url]) |
1710 | 1706 |
1711 project = settings.GetProject() | 1707 project = settings.GetProject() |
1712 if project: | 1708 if project: |
1713 upload_args.extend(['--project', project]) | 1709 upload_args.extend(['--project', project]) |
1714 | 1710 |
1715 try: | 1711 try: |
1716 upload_args = ['upload'] + upload_args + args | 1712 upload_args = ['upload'] + upload_args + args |
1717 logging.info('upload.RealMain(%s)', upload_args) | 1713 logging.info('upload.RealMain(%s)', upload_args) |
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2878 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 2874 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
2879 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 2875 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
2880 | 2876 |
2881 | 2877 |
2882 if __name__ == '__main__': | 2878 if __name__ == '__main__': |
2883 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2879 # These affect sys.stdout so do it outside of main() to simplify mocks in |
2884 # unit testing. | 2880 # unit testing. |
2885 fix_encoding.fix_encoding() | 2881 fix_encoding.fix_encoding() |
2886 colorama.init() | 2882 colorama.init() |
2887 sys.exit(main(sys.argv[1:])) | 2883 sys.exit(main(sys.argv[1:])) |
OLD | NEW |