Chromium Code Reviews| 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 if cl.GetRemoteUrl() and '/' in cl.GetUpstreamBranch(): | 1701 remote = cl.GetRemoteUrl() |
|
Sam Clegg
2014/10/14 22:45:49
'/' seems to always be in the branch name even for
| |
| 1702 remote_url = (cl.GetRemoteUrl() + '@' | 1702 branch = cl.GetUpstreamBranch() |
| 1703 + cl.GetUpstreamBranch().split('/')[-1]) | 1703 if remote and branch: |
| 1704 if 'googlesource' in remote: | |
| 1705 remote_url = remote + '/+/' + branch.split('/')[-1] | |
| 1706 else: | |
| 1707 remote_url = remote + '@' + branch.split('/')[-1] | |
|
Sam Clegg
2014/10/14 22:45:49
Should we leave '@' as the default? I guess it ma
| |
| 1704 if remote_url: | 1708 if remote_url: |
| 1705 upload_args.extend(['--base_url', remote_url]) | 1709 upload_args.extend(['--base_url', remote_url]) |
| 1706 | 1710 |
| 1707 project = settings.GetProject() | 1711 project = settings.GetProject() |
| 1708 if project: | 1712 if project: |
| 1709 upload_args.extend(['--project', project]) | 1713 upload_args.extend(['--project', project]) |
| 1710 | 1714 |
| 1711 try: | 1715 try: |
| 1712 upload_args = ['upload'] + upload_args + args | 1716 upload_args = ['upload'] + upload_args + args |
| 1713 logging.info('upload.RealMain(%s)', upload_args) | 1717 logging.info('upload.RealMain(%s)', upload_args) |
| (...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2874 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 2878 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
| 2875 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 2879 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
| 2876 | 2880 |
| 2877 | 2881 |
| 2878 if __name__ == '__main__': | 2882 if __name__ == '__main__': |
| 2879 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2883 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 2880 # unit testing. | 2884 # unit testing. |
| 2881 fix_encoding.fix_encoding() | 2885 fix_encoding.fix_encoding() |
| 2882 colorama.init() | 2886 colorama.init() |
| 2883 sys.exit(main(sys.argv[1:])) | 2887 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |